I know that ColumnSeries are not compatible with NumericXAxis, but i want to create a Histogram of Numeric values and show another LineSeries ( Probability Distribution Fit ) above it. I can do it using CategoryXAxis, but there are many problems with Ticks on X-Axis, As you can see in the image, Ticks are showing in the middle of columns.
And if there are two many Columns then they would collide. So i was thinking if it is possible to use NumericXAxis which has lots of great options for Tick Position and interval. I tried to overlay a NumericXAxis on this chart, but values didn't match, So Could Someone help me on this one
Hello Dariush,
Thank you for your post.
Unfortunately, I am unable to see the image that you had attached, but you are going to have a hard time aligning the NumericXAxis values to the CategoryXAxis values when using a column series, as the label placement is calculated internally when a column series is used, and these calculations are based upon the number of columns needed. That said, the label placement of the NumericXAxis will almost always differ from a CategoryXAxis when a ColumnSeries is present.
I am wondering, what is keeping you from using a LineSeries and sharing the CategoryXAxis with the ColumnSeries? Perhaps it would be better explained by your attempted attached image? Would it be possible for you to please try reattaching that image so that I may see it?
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer
Hello Andrew.
Thank you for your Reply.
I edited my post, and now you can see the image. (Not sure why it wasn't showing up in the first place. Image was added inline with text, now i added it as attachment )
Thank you for reattaching the image - I am able to see it now.
This behavior that you are seeing with the tick marks in the XamDataChart is expected behavior. The tick marks are measured and configured to show up between each category for the columns, unless there are many small ones, in which case some of the tick marks may be omitted.
The issue with the NumericXAxis is expected as well. The labels for the NumericXAxis and a ColumnSeries CategoryXAxis will be drawn very differently, in that the labels for the NumericXAxis will try to align with the vertical major grid lines of the XamDataChart, and the ColumnSeries CategoryXAxis labels will try to align with the columns in that particular series. This makes it very difficult to try to align your axes together, as the spacing between the ColumnSeries labels really depends on how many categories you have in your chart, and how many series you plan on placing in there as well.
It will be rather difficult to align the XamDataChart columns with a NumericXAxis' tick marks and labels, but there is nothing really stopping you from grabbing the columns or the labels and providing an offset to them in order to realign them. An example of how you could get these columns or the labels can be found at the following two forum threads:
Labels: http://www.infragistics.com/community/forums/t/76297.aspx.
Columns: http://www.infragistics.com/community/forums/t/97838.aspx.
As for actually getting the tick marks, these marks are a single path object with a rather complex geometry. Due to this, you might actually be better off drawing your own tick marks on the Canvas of the XamDataChart to get them to align to the center of your columns. As an alternative, though, if you would like to see the ability to align the tick marks, columns, or labels to the ColumnSeries in the way that they are aligned with a LineSeries or a ScatterLineSeries, I would recommend suggesting a new product idea for this feature at http://ideas.infragistics.com. This product ideas site will place you in direct communication with our product management teams who plan and prioritize upcoming features based on community and user feedback.
Hello Andrew
Thanks for your quick reply. I just found a work around which works.
The basic idea is to use a Visible NumericXAxis and a Hidden CategoryXAxis together.
Assuming both LineSeries and ColumnSeries have the same data, and they are equally spaced (Like any Histogram),Then for aligning TickMarks I added Two data-points to my LineSeries.
XValue of this data-points are:
1: XValues.Min - 0.5 * ( XValues.Range / XValues.Count ) and
2: XValues.Max + 0.5 * ( XValues.Range / XValues.Count ) and
Yvalues of them are Simply NaN, So they are not displayed. The XValues of these two pints are simply first and last edges of ColumnSeries.
I hadn't thought of that, but it makes sense that it would work as a workaround on this matter. I am glad that you were able to find a solution that works for you on this issue.