开发者

line radchart is displaying values for both lines

I have a radchart that is supposed to display two lines with separate Y values, but when it loads it displays two lines, but they both have Y values that they are supposed to display and the Y values of the other line in the chart ie: (Data set 1: 1,2,6,9) (Data set 2: 1,4,6,7) (Lines display like: 1-1-2-4-6-6-9-7 and 1-1-2-4-6-6-9-7)

my series mapping looks like this:

<telerik:SeriesMapping LegendLabel="Line Series 1" >
    <telerik:SeriesMapping.SeriesDefinition>
        <telerik:StackedLineSeriesDefinition />
    </telerik:SeriesMapping.SeriesDefinition>
        <telerik:ItemMapping FieldName="LineYValue" DataPointMember="YValue" />
    </telerik:SeriesMapping>

    <telerik:SeriesMapping LegendLabel="Line Series 2" >
        <telerik:SeriesMapping.SeriesDefinition>
            <telerik:StackedLineSeriesDefinition />
        </telerik:SeriesMapping.SeriesDefinition>
        <tele开发者_开发技巧rik:ItemMapping FieldName="LineYValue" DataPointMember="YValue" />
    </telerik:SeriesMapping>
</telerik:RadChart.SeriesMappings>

and in my ViewModel I have the data loaded like so

if (salesAndQtyByHour != null)
{
    STUFF.ChartModels.Charts tempChart1 = new ODA.ChartModels.Charts() { ChartTitle = "Sales And Quantity By Hour" };
    foreach (var item in salesAndQtyByHour)
    {
        tempChart1.myCharts.Add(new STUFF.ChartModels.Chart() { LineName = "Quantity", LineXValue = item.MilitaryTime, LineYValue = item.QtyOfItems });
        tempChart1.myCharts.Add(new STUFF.ChartModels.Chart() { LineName = "Basket", LineXValue = item.MilitaryTime, LineYValue = item.Basket });
    }
    SalesAndQtyByHour = tempChart1;
}

I'm pretty sure its the CollectionIndex, but I'm not sure how to implement it in my case, I'm relatively new to this job.

Any help would be appreciated.


There is ItemsSource property of the SeriesMapping object. You can send each individual dataset to the corresponding SeriesMapping. Article: http://www.telerik.com/help/silverlight/radchart-populating-with-data-series-mapping-items-source.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜