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

[Solved] Grouping problem with missing points

5 Answers 167 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Miles
Top achievements
Rank 1
Miles asked on 23 Jun 2011, 08:54 AM
Hi

I've got a problem with Grouping. I am building a chart for foreign currency trading, with FinancialYear (int) on the X Axis and VolumeTraded (decimal) on the Y Axis. I am retrieving data from a view using a raddomaindatasource and ria. I then group by Currency to build a stacked bar or stacked area chart. Some years, the client does not trade a particular currency. This creates problems. When I use a stacked area, say a currency is missing in 2007, a line is drawn straight from 2006 to 2008. It should follow the area below it. When I use a stacked bar, the result is OK. But when I use XCategory instead of XValue, I find that the 2007 stack will appear at the far right end. Also when I use XCategory and stacked area, 2007 is at the far right end and the area shapes that are drawn are... somewhat strange indeed.

      <telerik:SeriesMapping x:Name="barChartMapping" ChartAreaName="chartArea1" ItemsSource="{Binding DataView, ElementName=rddsAllYears}">

          <telerik:SeriesMapping.SeriesDefinition>

              <telerikCharting:StackedAreaSeriesDefinition ShowItemLabels="False" />

          </telerik:SeriesMapping.SeriesDefinition>

          <telerik:SeriesMapping.ItemMappings>

             <telerik:ItemMapping FieldName="FinancialYear" DataPointMember="XValue" />

              <telerik:ItemMapping FieldName="VolumeTraded" DataPointMember="YValue" />

          </telerik:SeriesMapping.ItemMappings>

          <telerik:SeriesMapping.GroupingSettings>

              <telerik:GroupingSettings>

                  <telerik:ChartGroupDescriptor Member="Currency"/>

              </telerik:GroupingSettings>

          </telerik:SeriesMapping.GroupingSettings>

      </telerik:SeriesMapping>

5 Answers, 1 is accepted

Sort by
0
Hunter Kingsley
Top achievements
Rank 1
answered on 23 Jun 2011, 06:06 PM
I have a very similar issue. A bar series and a line series, where the line is filtered to COMPLETE and the bar is filtered to INCOMPLETE. This by week. If everything in a given week is one or the other, COMPELTE or INCOMPLETE but not both, the series plotted on the x-axis shows the weeks with COMPLETE, in order, then the weeks with INCOMPLETE that didn't match up with a COMPLETE week, in order.

The rub is that I'm using ChartAgregateFunction.Average. So, if I take my data collection, and insert an empty reference for each week, so that COMPLETE and INCOMPLETE are always present in any week, I throw off the average as the denominator would be +1, sometimes.

I suppose a solution would be to add a third series, without the filter, and chart that first, then make it invisible. Seems clunky though.
0
Miles
Top achievements
Rank 1
answered on 24 Jun 2011, 01:08 AM
That is a problem with the Average. I can at least work around for now by using XValue and a stacked bar.

Some general suggestions for Telerik:
I find that it is quite difficult to find/learn how to do the more advanced stuff. Like aggregates, messing with axes, multiple chart areas etc. It might take me a few hours to work it out instead of a few minutes. I'm not sure if they exist and I just can't find them, but it would be really handy if there was just a ton of short videos. Then have a page with a picture of each of the charts and a 3 sentence description. That way I could just find the chart that kind of matches my situation and watch the video. Currently the best source I have for this is the quick start demos. The problem is your code for those is quite advanced and often hard to learn from by just looking at the finished product. With binding etc, it's not often linear. Same goes with style stuff. I'm not really an artistically blessed guy so when I see something I like in your quick starts and try to copy it, it can be quite difficult.
0
Yavor
Telerik team
answered on 28 Jun 2011, 12:24 PM
Hello Miles,

Thank you for your suggestions!
We appreciate your feedback and will consider it for our future plans. Meanwhile, may I point you to our online help, where topics are focused on specific issues/features, so you can review their particular implementations.

As to your question, the problem that you are experiencing using StackedArea chart is because the data that is going to be grouped is not aligned. Two Series are considered to be aligned if they have the same number of data points and the same data in their corresponding X values. You can insert empty entries for a specific year as Timothy Proksch suggested.

When you are using categories instead of X values each values is treated as a string and it is not sorted. This is the reason why the bar for 2007 in your scenario appears last.

Greetings,
Yavor Ivanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Miles
Top achievements
Rank 1
answered on 29 Jun 2011, 12:35 AM
Thanks Yavor

That is extraordinarily disappointing and something I would suggest your team look at fixing. Binding to a collection of business objects is the model we are told to shoot for. Now I have to start adding empty objects to my collection to make the chart work. And I have to do that every time I want to make this kind of chart. Not cool. Basically, stacked area is now useless for me. I also don't see anywhere in the documentation that mentions having to have aligned data series. Am I missing that?
0
Yavor
Telerik team
answered on 29 Jun 2011, 12:20 PM
Hi Miles,

Indeed, we have failed to provide this information in our documentation. Please, accept our apologies for this. It will be added shortly.

Unfortunately I cannot propose any other suggestion regarding your problem except the one mentioned before.

Kind regards,
Yavor Ivanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart
Asked by
Miles
Top achievements
Rank 1
Answers by
Hunter Kingsley
Top achievements
Rank 1
Miles
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or