Common Width for Bar Series

Jan 3, 2012 at 8:40 PM

This one is kind of hard to explain.

I have a single chart, with 3 series. 2x Bar Series and 1x Line Series all against the same category axis. 1 bar series is all positive values, and the other is all negative values. I would like to display the series similar to a "stacked" series, but without the values being added. I would like the 2 bars to share their width across the category axis, with one series above zero and the other below zero. Any ideas how I can do this?

Great control by the way! Love it

Coordinator
Jan 3, 2012 at 9:05 PM
Edited Jan 3, 2012 at 9:12 PM

I see what you mean. That is something we should support, let me think about how to do it. I am adding it to the issue tracker. I think it should be implemented as a stacked bar series where negative values are accumulated below the 'base line'.

Jan 3, 2012 at 9:31 PM

If you can't think of a way to do it in the current code, I am happy to do the coding to support it and add it to the project for you. I was thinking of changing the IsStacked property to an enum called StackType containing the following values - None (default), Additive, Seperate. Then modify the rendering process to render appropriately (just an extra branch for bar calcuation inside the current "IsStacked == true" branch)

Coordinator
Jan 3, 2012 at 9:41 PM

Great if you would like to create a patch for this! Does stacking mixed negative and positive numbers make sense? I don't think it is neccessary to create the StackType enum, simply stack positive values above the 'baseline' and negative values below the 'baseline'. 

If you create a patch, please make test cases for both horizontally and vertically stacked series.

Jan 3, 2012 at 9:54 PM

Yes I think you are right, it does look weird when you stack positives and negatives anyway (I tried). I will take a look at it tonight and see what I can do.

Jan 4, 2012 at 1:26 PM

By test cases do you mean nunit tests? or examples?

I wasn't able to find any tests which tested rendering (I only have the OxyPlot.WPF solution open at the moment though). I have created examples though.

I have got the code working well enough for my use today. I will look more closely and do some more analysis of my changes tonight before submitting any patch

Coordinator
Jan 4, 2012 at 1:31 PM

good, I was meaning examples in the ExampleLibrary (then it is easy to test on all platforms). Great if you can include both a horizontal and vertical example!

Jan 4, 2012 at 1:33 PM

Thanks objo

I will hopefully submit a patch for you to review tonight. I also have another issue I will raise in the tracker and have a little look at with line smoothing

Jan 5, 2012 at 9:10 PM

I have now submitted a patch. Ive not submitted a patched to codeplex before so I was unsure about the format expected... I have just uploaded a zip file containing the changed files in their appropriate paths.

Coordinator
Jan 5, 2012 at 9:28 PM

Cool, I will have a look as soon as I get some time (I am a bit busy right now, hopefully early next week!)

If you use TortoiseSVN it should be very easy to create a patch, read the manual!

Jan 6, 2012 at 2:17 PM

I have resubmitted as a svn patch. I forgot to click add on the Work Item this time though...

Feb 9, 2012 at 7:00 PM
Edited Feb 9, 2012 at 7:00 PM

As a further to this. With this particular graph, I have created separate axis for the BarSeries and LineSeries in it. The axis for the BarSeries is on the left, the Axis for the line series is on the right. Due to the values in use, the 0 point of the axis do not match. How would I go about getting the 0 point of the 2 vertical linear axes to line up (without hard coding the axis range)?

Coordinator
Feb 20, 2012 at 10:14 PM

Sorry, 'synchronized' axes are currently not supported. I added it as issue 9945.