Common Width for Bar Series

Oystein Bjorke 10 lat temu 0
This discussion was imported from CodePlex

jezza323 wrote at 2012-01-03 20:40:

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


objo wrote at 2012-01-03 21:05:

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'.


jezza323 wrote at 2012-01-03 21:31:

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)


objo wrote at 2012-01-03 21:41:

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.


jezza323 wrote at 2012-01-03 21:54:

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.


jezza323 wrote at 2012-01-04 13:26:

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


objo wrote at 2012-01-04 13:31:

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!


jezza323 wrote at 2012-01-04 13:33:

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


jezza323 wrote at 2012-01-05 21:10:

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.


objo wrote at 2012-01-05 21:28:

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!


jezza323 wrote at 2012-01-06 14:17:

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


jezza323 wrote at 2012-02-09 19:00:

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)?


objo wrote at 2012-02-20 22:14:

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