This is a migrated thread and some comments may be shown as answers.

Issue with Chart with Date on XAxis

1 Answer 50 Views
Chart
This is a migrated thread and some comments may be shown as answers.
JAS J
Top achievements
Rank 1
JAS J asked on 07 Sep 2011, 05:11 PM
I have a QueryViewCollection of the following object

public class ChartData {

    public CallData(DateTime dt, int d, int y) {
        XValue = d; YValue = y; ateX = dt;
    }
    public double DateOA { get { return DateX.ToOADate(); } }
   
public DateTime DateX { get; set; }
    public int XValue { get; set; }
    public int YValue { get; set; }

}

When I databind the itemsource of the chart to the QueryViewCollection Object and bind to a SeriesMappingCollection which I initialize so:

SummaryChartSMC = new SeriesMappingCollection();
LineSeriesDefinition lsd = new  LineSeriesDefinition() {ShowItemLabels = false, ShowPointMarks = false};
SeriesMapping sm = new SeriesMapping();
sm.CollectionIndex = 0;
sm.SeriesDefinition = bsd;
sm.ItemMappings.Add(new ItemMapping("DateOA",DataPointMember.XValue));
// Also tried:sm.ItemMappings.Add(new ItemMapping("DateX",DataPointMember.XValue));

sm.ItemMappings.Add(new ItemMapping("YValue", DataPointMember.YValue));
sm.ChartArea = new ChartArea();
sm.ChartArea.AxisX.IsDateTime = true;
sm.ChartArea.ZoomScrollSettingsX.MinZoomRange = 1;
sm.ChartArea.AxisX.MinValue = DateTime.Now.AddHours(-12).ToOADate();
sm.ChartArea.AxisX.MaxValue = DateTime.Now.AddHours(+12).ToOADate();
SummaryChartSMC.Add(sm);

I get the "No Data Series" message in my chart.

I know the rest it work because If I use
sm.ItemMappings.Add(new ItemMapping("XValue", DataPointMember.XValue));
and DONT do the IsDateTime and the Axis MinZoomRange and Min/max Value etc, the charts shows up fine.

I think I am missing some anyone see what I am doing wrong?

thanks,
Jas

 

 

 

1 Answer, 1 is accepted

Sort by
0
JAS J
Top achievements
Rank 1
answered on 07 Sep 2011, 06:18 PM
Took out the IsDateTime and it worked,
thanks,
Jas
Tags
Chart
Asked by
JAS J
Top achievements
Rank 1
Answers by
JAS J
Top achievements
Rank 1
Share this question
or