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

How to control the plot order for multiple series

2 Answers 107 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
mao
Top achievements
Rank 1
mao asked on 01 Nov 2016, 02:59 PM

for example, 

Series 1:   X: P1 P1 P2

                 Y   2   3  4     

 

Series 2   X:P1 P1 P2

                Y: 5   6   7

 

If they are plotted in graph as bar series. I expected the plot order as (series1 ->P1,2) (series2->P1,5) (series 1->P1,3) (series 2->P1,6) (series1 ->P2,4) (series2 ->P2,7) . that means all the P1 category  will be grouped together and has the value order  as (2,5,3,6). And P2 category has value order(4,7)

 

 

 

but actually, it looks like P1 category  has the value order as (2,3,5,6)   and P2 category has value order(4,7)

 

in order to achieve what I want, I have to flatten the two series (series1 and series 2) into one series. But that approach is not exactly what I want. Thank you

2 Answers, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 04 Nov 2016, 08:16 AM
Hi Mao,

Let me first explain in more details how RadChartView renders the series data points.

When a single series is passed for the categorical axis, its points are plotted in the order they appear in the collection. When the series are more than one, each slot of the categorical axis is divided corresponding to the number of the series which holds. 

I am going to use the sample scenario from your post. It contains two series, therefore, each category slot (P1 and P2) will be divided into two parts - the first one will accommodate the data points of the first series and the second one - from the second series. The slots are filled with the data points consecutively, starting with the data points from the first declared series.

With that said, the workflow of the would look as follows:

P1 will contain two parts:
P1 (1) will accommodate the P1's values from the first series - 2 and 3
P1 (2) will be reserved for the data points of the second series from the P1 category - 5 and 6

P2 is divided into two parts as well:
P2 (1) renders 4
P2 (2) renders 7

The plot order is automatic and you can control it only through the collection you are passing to the series. Having this in mind, the union of both collections and using a single series is the only approach I can suggest you.

Hope this is helpful.

Regards,
Tanya
Telerik by Progress
Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
0
mao
Top achievements
Rank 1
answered on 04 Nov 2016, 01:46 PM
Thank you so much, Tanya. Very helpful explanation. 
Tags
ChartView
Asked by
mao
Top achievements
Rank 1
Answers by
Tanya
Telerik team
mao
Top achievements
Rank 1
Share this question
or