SplineSeries - Y Axis cut line

4 posts, 0 answers
  1. Francesco
    Francesco avatar
    5 posts
    Member since:
    Oct 2012

    Posted 18 Oct 2012 Link to this post

    Hi, 

    i have a problem with SplineSeriesDefinitinion.
    On my project i have a RadChart with different SeriesDefinition on the same Data. I have buond the seriesDefinition type with the model, therefore i can change the series definition at runtime (without use code behind but only model).

    The series definition that i use are:
    • StackedBarSeriesDefinition
    • StackedBar100SeriesDefinition 
    • BarSeriesDefinition
    • SplineSeriesDefinition

    I attach code (xaml) and image (1.png, 2.png, 3.png) for example.

    <telerik1:RadChart x:Name="PassFailChart" BorderThickness="0" Padding="0,10,0,0" Background="{x:Null}" IsTabStop="False" Grid.Row="1">
                <telerik1:RadChart.DefaultView>
                    <telerik1:ChartDefaultView>
                        <telerik1:ChartDefaultView.ChartLegend>
                            <telerik1:ChartLegend x:Name="chartLegend" LegendItemMarkerShape="Circle" Background="{x:Null}" BorderBrush="{x:Null}" UseAutoGeneratedItems="True" />
                        </telerik1:ChartDefaultView.ChartLegend>
                        <telerik1:ChartDefaultView.ChartArea>
                            <telerik1:ChartArea LegendName="chartLegend">
                                <telerik1:ChartArea.AxisY>
                                    <telerik1:AxisY StripLinesVisibility="Hidden" MinorTicksVisibility="Hidden" ExtendDirection="Up" />
                                </telerik1:ChartArea.AxisY>
                            </telerik1:ChartArea>
                        </telerik1:ChartDefaultView.ChartArea>
                    </telerik1:ChartDefaultView>
                </telerik1:RadChart.DefaultView>
                <telerik1:RadChart.AnimationSettings>
                    <telerik1:AnimationSettings ItemDelay="00:00:00" DefaultSeriesDelay="00:00:01" />
                </telerik1:RadChart.AnimationSettings>
                 
                <telerik1:RadChart.SeriesMappings>
                    <telerik1:SeriesMapping LegendLabel="{Binding ElementName=cbPass, Path=Content}" ItemsSource="{Binding Path=GraphRuntime[Pass], Mode=TwoWay}" SeriesDefinition="{Binding Path=PassDefinition, Mode=TwoWay}">
                        <telerik1:SeriesMapping.ItemMappings>
                            <telerik1:ItemMapping DataPointMember="YValue" FieldName="Value"/>
                            <telerik1:ItemMapping DataPointMember="XCategory" FieldName="Label" />
                        </telerik1:SeriesMapping.ItemMappings>
                    </telerik1:SeriesMapping>
                    <telerik1:SeriesMapping LegendLabel="{Binding ElementName=cbFail, Path=Content}" ItemsSource="{Binding Path=GraphRuntime[Fail], Mode=TwoWay}" SeriesDefinition="{Binding Path=FailDefinition, Mode=TwoWay}">
                        <telerik1:SeriesMapping.ItemMappings>
                            <telerik1:ItemMapping DataPointMember="YValue" FieldName="Value"/>
                            <telerik1:ItemMapping DataPointMember="XCategory" FieldName="Label"/>
                        </telerik1:SeriesMapping.ItemMappings>
                    </telerik1:SeriesMapping>
                    <telerik1:SeriesMapping LegendLabel="{Binding ElementName=cbReconstitution, Path=Content}" ItemsSource="{Binding Path=GraphRuntime[Reconstitution], Mode=TwoWay}" SeriesDefinition="{Binding Path=ReconstitutionDefinition, Mode=TwoWay}" >
                        <telerik1:SeriesMapping.ItemMappings>
                            <telerik1:ItemMapping DataPointMember="YValue" FieldName="Value"/>
                            <telerik1:ItemMapping DataPointMember="XCategory" FieldName="Label"/>
                        </telerik1:SeriesMapping.ItemMappings>
                    </telerik1:SeriesMapping>               
                </telerik1:RadChart.SeriesMappings>
            </telerik1:RadChart>


    When the graph opened, all graph it's ok (view image).

    If i select StackedBar100SeriesDefinition the axisY range changed, but when i return to SplineSeriesDefinition the graph is cut (like image problem.png).
    This problem occurs and remain only if i select StackedBar100SeriesDefinition. For resolve the problem, software must be restarted.


    Another problem with the SplineSeriesDefinition is that on the X-Axis the first label is cut (like problem.png image and 2.png image). Is there a way to resolve this issue?

    Thanks in advance.
    Francesco.
  2. Nikolay
    Admin
    Nikolay avatar
    385 posts

    Posted 22 Oct 2012 Link to this post

    Hi Francesco,

    Regarding the first problem, you can try setting the ExtendDirection property of the Y axis to Smart, instead of Up. In case this does not work, then another possible manner to handle the issue would be to set manually the Y-axis range dynamically when you switch from StackedBar100 to Spline.

    As for the first label of the X-axis not being clearly visible, you can handle it by altering the LabelRotationAngle, so that the label is visible. You can find more information on this property and other axis features in this help topic.

    Regards,
    Nikolay
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Francesco
    Francesco avatar
    5 posts
    Member since:
    Oct 2012

    Posted 22 Oct 2012 Link to this post

    Thank you for your reply,

    Regarding the fisrt problem, i have already tried this property. If i set ExtendDiretction to "smart", Spline graph has the same problem.
    I already thought the solution to manually change Y-range, but I was hoping there was a workaround because the range changes often.
    Is there another way to fix this problem? Why the Spline graph is not to be able to autorange right?
    Is able to change the range manually in the RangeChanged event? Then, after the graph has changed the range automatically, i added a 10% more.

    Regarding the second problem, i'm sorry but I do not have enough space to change LabelRotationAngle. Is there a way to view only some label (when the axis is autorange) ? in this case the first label is hidden, and label starts in the second step.
  5. Nikolay
    Admin
    Nikolay avatar
    385 posts

    Posted 25 Oct 2012 Link to this post

    Hi,

    Unfortunately the auto range mechanism does not take into account the spline's peak between two points - only the values of the points, which is why such scenario may occur when there are two consecutive points with close values. This is why the best solution to handle this issue would be to set the axis range manually when switching from StackedBar to Spline.

    Regarding the X-axis labels, there are a few more options to handle the long labels, the easiest one being to change the DefaultLabelFormat, so that the label is displayed on two levels and/or perhaps shortening the month string from October to Oct. You can find similar examples here and here.

    While it is not supported to skip only the first label, it would be possible to display one of each N number of labels using the LabelStep property. You may also change the axis LayoutMode to Inside, which would provide a bit more space for the first label.

    Greetings,
    Nikolay
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top