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
3220
xamDataChart: Set X-Axis to null
posted

Hello,

I set my series in code behind, since my data are dynamically, also the data source of the xAxis. When I create new series in code behind and also setting the x-axis, the data are shown correctly in the chart. But when I delete all series and also set the x-axis items source to null, the x-axis is still showing the old x-axis lables.

1) Correct loaded chart:

2) when switching to empty data, the chart is empty but the x-axis remains.

Code behind:

How can I clear the x-axis?

Parents
  • 34830
    Offline posted

    Hello Bin,

    I have been investigating into the behavior you are seeing, but at the moment, I cannot seem to reproduce a scenario in which the X-Axis remains after clearing its ItemsSource and clearing the Series collection of the grid.

    From your screenshots, I was unsure of whether you were using a CategoryXAxis, CategoryDateTimeXAxis, or TimeXAxis, so I put together a sample project that uses all three and you can dynamically switch between them. In doing so and having a button click that clears the Series collection of the chart and sets the ItemsSource of the Axis to null, all three axes are acting the same way on my end in that they are disappearing.

    I have attached the sample project I used to test this.  Please test this project on your PC; whether or not it works correctly may help indicate the nature of this problem.

    If the project does not work correctly, this indicates either a problem possibly specific to your environment, or a difference in the DLL versions we are using.  My test was performed using versions 20.2.20202.63 in Infragistics for WPF 2020 Volume 2 and 21.1.20211.48 of Infragistics for WPF 2021.1.

    If the project does show the product feature working correctly, this indicates a possible problem in the code of your application.  It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.

    Or, if this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back, or send a small sample project of your own if you have one.

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

    XamDataChartClearAxisDemo.zip

Reply Children