I am having problems displaying Histogram(bar series) with Points(point series) within them in a CartesianChart in WPF.
If I declare only one single Horizontal axis(Categorical) for both the series, then the series are appearing one after another horizontally.
If I declare two separate axis(categorical) for both, then the scales arent getting adjusted equally.
I would want to achieve such that either both share a single Horizontal axis and both series are drawn overlapping or
let both series have two separate axis and their scale is equvivalent.
How do I achieve this?
5 Answers, 1 is accepted
If I have correctly understood your scenario you want the series to be placed one over another. I have created a sample project which demonstrates this approach. Can you give it a try and let me know if this works for you? If not can you elaborate more on using the project how the series need to be position on the plot area?
Thank you for the demo.
I went thro' the code and understood that the X axis for both the series are same and hence it plots perfectly fine.
But in my case X axis for both the series are different, hence I might need two different X axis.
So is there a way if we can adjust both the axes' scale? My requirement is to draw list of points under a Histogram. Hence Bar series with Point series.Please let me know if there is any alternate solution to this.
What I can suggest you is to take a look at the Multiple Axes help article in our documentation. This article described how you can add additional axes. I have also modified my project and added an additional axis for the Points series which position is under the first axis.
Give this project a try and let me know if I was able to help you.
Thank you for the demo project, I am able to achieve this if both of my axis are similar, that is Categorical axis.But, in my case I have to have different type of axis since one of the series is Bar and the other is Point. And my horizontal axiss' scale would also be different since plotting of both the series is different. I have attached a photo of my requirement, please let me know if this can be done?
Thank you for the provided picture.
Looking at this image the axis on the top is numeric one. Correct me if I am wrong. In this case, you can use the ScatterPointSeries which uses Linear axis for both Vertical and Horizontal axis. To place the LinearAxis on the top you can set the VerticalLocation property to Top and specify the MajorStep property to 10. As for the Bar series, from the picture, it is not clear that if want to have the bar next to each other or not. To control what space to take the bars you can set the GapLength property of the CategoricalAxis. Keep, in mind that this property is in relative units. (0-1). I have modified my previous project to demonstrate the steps above.