Hello Telerik,
I'm using a RadCartesianChart in WPF allowing a complete customization of the chart.
<chart:RadCartesianChart x:Name="BarChart" Visibility="{Binding VisibilityBars, Mode=OneTime}" Grid.ColumnSpan="2">
<telerik:RadCartesianChart.SmartLabelsStrategy>
<telerik:ChartSmartLabelsStrategy />
</telerik:RadCartesianChart.SmartLabelsStrategy>
<!--Series-->
<telerik:RadCartesianChart.SeriesProvider>
<telerik:ChartSeriesProvider Source="{Binding Series}" >
<telerik:ChartSeriesDescriptor ItemsSourcePath="DisplayValues" TypePath="ShapeType" >
<telerik:ChartSeriesDescriptor.TypeConverter>
<conv:ShapeTypeToSeriesTypeConverter ChartType="Bar" />
</telerik:ChartSeriesDescriptor.TypeConverter>
</telerik:ChartSeriesDescriptor>
</telerik:ChartSeriesProvider>
</telerik:RadCartesianChart.SeriesProvider>
<!--Axes-->
<chart:RadCartesianChart.HorizontalAxis>
<chartView:CategoricalAxis x:Name="horizontalAxis"
Title="{Binding HorizontalAxisTitle}"
/>
</chart:RadCartesianChart.HorizontalAxis>
<chart:RadCartesianChart.VerticalAxis>
<chartView:LinearAxis x:Name="verticalAxis"
Title="{Binding VerticalAxisTitle}"
MajorStep="{Binding VerticalAxisMajorStep}"
Minimum="{Binding VerticalAxisMinimum}"
Maximum="{Binding VerticalAxisMaximum}"
HorizontalLocation="Left" />
</chart:RadCartesianChart.VerticalAxis>
<chart:RadCartesianChart.Grid>
<chartView:CartesianChartGrid MajorLinesVisibility="XY" />
</chart:RadCartesianChart.Grid>
</chart:RadCartesianChart>
The chart allows the possibility to custom the series for the PointType and the PointShape. I'm using a ShapeTypeToSeriesTypeConverter class, as below:
Public Class ShapeTypeToSeriesTypeConverter
Implements IValueConverter
Public Property ChartType As String
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
If value Is Nothing OrElse TypeOf (value) IsNot ChartSerieModel.ShapeTypes Then
Return Nothing
End If
Dim ShapeType As ChartSerieModel.ShapeTypes = CType(value, ChartSerieModel.ShapeTypes)
Select Case ChartType
Case "Radar"
Select Case ShapeType
Case ChartSerieModel.ShapeTypes.None
Return GetType(RadarPointSeries)
Case ChartSerieModel.ShapeTypes.Line, ChartSerieModel.ShapeTypes.DashedLine
Return GetType(RadarLineSeries)
Case ChartSerieModel.ShapeTypes.Area
Return GetType(RadarAreaSeries)
Case Else
Return Nothing
End Select
Case "Scatter"
Select Case ShapeType
Case ChartSerieModel.ShapeTypes.None
Return GetType(ScatterPointSeries)
Case ChartSerieModel.ShapeTypes.Line, ChartSerieModel.ShapeTypes.DashedLine
Return GetType(ScatterLineSeries)
Case ChartSerieModel.ShapeTypes.Area
Return GetType(ScatterAreaSeries)
Case Else
Return Nothing
End Select
Case Else
Select Case ShapeType
Case ChartSerieModel.ShapeTypes.None
Return GetType(PointSeries)
Case ChartSerieModel.ShapeTypes.Line, ChartSerieModel.ShapeTypes.DashedLine
Return GetType(StepLineSeries)
Case ChartSerieModel.ShapeTypes.Area
Return GetType(BarSeries)
Case Else
Return Nothing
End Select
End Select
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException()
End Function
End Class
The problem is on the Else case (BarChart) when I select None shape. I tried with PointSeries and LineSeries because this is the result I want but as you can see in the attached file "none shape.png", the full green serie is hidden.
Excepected result:
- PointSeries: only the points should be visible, no link
- LineSeries: the points should be visible and they should be linked by a direct line
Do you know how can I link the points using a direct line (and not the like the StepLineSeries)?
Attached files (here):
- shape choice.png: example of shapes choice
- line shape.png: example when the Line shape is selected, and the green serie is correctly displayed
Many thanks.
Valentin M.
Hello Martin,
As you can see in the attached files, the light purple serie is a BarSeries (type=Area). In the two first screens, the green and the dark purple series are a StepLineSeries, but in the last screen the green serie is a PointSeries, and this is why it disappears.
Valentin M.
Hey Valentin,
I am afraid that without recreating this behavior I cannot tell what exactly is happening. And I cannot recreate it without having the complete setup that adjusts the view and the view models. This said, would it be possible to send over a project showing the exact setup? This way I can test it and see what is going on.