This is a migrated thread and some comments may be shown as answers.

Exception thrown attempting to set StrokeDashArray on CartesianChartGrid

2 Answers 31 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Jeremy
Top achievements
Rank 1
Jeremy asked on 12 Sep 2019, 09:35 PM

     I am attempting to style a CartesianChartGrid's X and Y lines by setting the StrokeDashArray property.  However, when attempting to run the application, I receive an exception stating that the doublecollection must be unfrozen.  Here is the code snippet and I have attached the resulting exception message..

 

      <telerik:RadCartesianChart Width="400" Height="250">
            <telerik:RadCartesianChart.HorizontalAxis>
                <telerik:LinearAxis />
            </telerik:RadCartesianChart.HorizontalAxis>
            <telerik:RadCartesianChart.VerticalAxis>
                <telerik:LinearAxis/>
            </telerik:RadCartesianChart.VerticalAxis>
            <telerik:ScatterPointSeries>
                <telerik:ScatterPointSeries.DataPoints>
                    <telerik:ScatterDataPoint XValue="1" YValue="1" />
                    <telerik:ScatterDataPoint XValue="5" YValue="3" />
                    <telerik:ScatterDataPoint XValue="8" YValue="11" />
                </telerik:ScatterPointSeries.DataPoints>
            </telerik:ScatterPointSeries>
            <telerik:RadCartesianChart.Grid>
                <telerik:CartesianChartGrid MajorLinesVisibility="XY" >
                    <telerik:CartesianChartGrid.MajorXLineStyle>
                        <Style TargetType="Line">
                            <Setter Property="Stroke" Value="Pink"/>
                            <Setter Property="StrokeDashArray" Value="4,2"/>
                        </Style>
                    </telerik:CartesianChartGrid.MajorXLineStyle>
                </telerik:CartesianChartGrid>
            </telerik:RadCartesianChart.Grid>
        </telerik:RadCartesianChart>

2 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 13 Sep 2019, 11:58 AM

Hello Jeremy,

This behavior appears because the dash array is applied over a brush that is already frozen. Setting the StrokeDashArray property via the line style property is not supported. Instead, use the MajorXLineDashArray and MajorXLineDashArray properties.

<telerik:CartesianChartGrid  MajorXLineDashArray="4,2" />

This piece of information is missing from our documentation. This is why, I've logged it and updated your Telerik points.

Regards,
Martin Ivanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jeremy
Top achievements
Rank 1
answered on 13 Sep 2019, 01:04 PM
Thank you so much Martin.  I happened to stumble on the MajorXLineDashArray last night in searching for other information.  It worked perfectly.  Thanks again.
Tags
Chart
Asked by
Jeremy
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Jeremy
Top achievements
Rank 1
Share this question
or