I am using a RadCartesian Chart where dynamically I want to use either Point Series or Spline Series. One at at time only. But I am not able to set they styles for both the type of series. How do I achieve this. Both are using Horizontal Categprical Axis and vertical Linear Axis. Please help me.
5 Answers, 1 is accepted
Do you mean that you need to switch dynamically in your application between PointSeries and SplineSeries using the same data?
If this is the case you can take a look at the attached project for a sample implementation of this scenario.
In the project there is a ChartSeriesProvider with a CategoricalSeriesDescriptor. The type of the visualized series is controlled by the style of the series descriptor. In the sample project there are two styles - one for PointSeries and one for SplineSeries. When the application is started the Style property of the series descriptor is set to the PointSeriesStyle. In the Button_Click event handler the Style property of the series descriptor is dynamically changed.
In case this project does not suit your needs can you give us a more detailed explanation about your scenario.
Thanks for the answer, Meanwhile I tried something like this.
Here is my Xaml.
I followed my idea of going ahead with styles. But I am struggling to bind the height and width of the points in Point Template. The color binding in Point Template is working fine.
Here is my code.
Here are my Models
Please Help me identify what is going wrong here. It would be really great if you could help me out.
Thanks in advance!
The height and width of the points are bound correctly. The reason for this behavior is that the relative source binding is completed too late. Before the binding of the width and height has been executed, the content presenter that is the container of the data template has already determined and cached it's width and height.
Finally the data template of the point series has correct width and height, but it's parent has width and height equal to 0.
One way to make the points appear is to modify the template. You can include an additional element with a static width and height and position the Rectangle in its center.
Please bear in mind, that the width and height of the border must be equal to the maximum possible width and height of the rectangle. Let us know if this solution works for you.