Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
Axis title with Legends and Y axis stroke
posted

Hi,

I need to implement the chart as given. I am stuck with 2 points.

1) How to draw the vertical line or Temperature Y-axis(second)? I have put strokes on the Green and Red line for left and right Y-axis with the CrossAxis and Crossing Value property.

But I don't know how to achieve this for Temperature axis.

2) For the Y-axis titles, I want to make templates with the legends and the units.

Any help is appreciated.

Parents
  • 34430
    Offline posted

    Hello Preeti,

    I have been investigating into the requirements that you are looking to achieve, and neither of these behaviors are available out-of-the-box with the XamDataChart at the moment. However, you may be able to achieve them by overlaying a transparent Canvas over the XamDataChart and getting the points of the elements that you are looking to change by using the TransformToAncestor method.

    You can get the axis panel by utilizing the Infragistics.Windows.Utilities class and its static GetDescendantFromType<T> method to get an underlying VerticalAxisLabelPanel from the chart. This method has a callback that can allow you to get all instances of these elements, which will allow you to get all of your label panels for your y axes. In doing so, you can handle the RefreshCompleted method of the XamDataChart and draw a border to the left side of your outer VerticalAxisLabelPanel using the point returned by the TransformToAncestor method mentioned above.

    The VerticalAxisLabelPanel elements have a Children collection that will also contain the TextBlock that makes up your axis title as well, and so to achieve your template functionality, you can get the point of this TextBlock and draw to the Canvas as well. You will not be able to add elements to this Children collection, as it is currently managed internally.

    I have attached a sample project to demonstrate the axis line functionality mentioned above. I hope this helps.

    If you would like to see "floating axis line" and axis title template functionality included in a future version of the XamDataChart, I would recommend suggesting a new product idea for this at our WPF ideas site. This will place you in direct communication with our product management teams who plan and prioritize upcoming features and development based on community and user feedback.

    Please let me know if you have any other questions or concerns on this matter.

    XamDataChartDemo.zip

Reply Children
No Data