SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

0
0

Dear all,

I am dynamically changing my series type by switching from Bar, to Line, or to scatter.
Bar and line works perfectly well, but have no idea why nothing gets displayed fore scatter.

Here the code below from your sample where I apply the style :

private IRenderableSeriesViewModel New(Type type, IDataSeries dataSeries = null)
    {
        var xyDataSeries = dataSeries ?? GetXyDataSeries(GetRanromWalk(0));
        if (type == typeof(ColumnRenderableSeriesViewModel))
        {
            return new ColumnRenderableSeriesViewModel {

                DataSeries = xyDataSeries,
                StyleKey = "BarSeriesStyle" };
        }


        if (type == typeof(LineRenderableSeriesViewModel))
        {
            return new LineRenderableSeriesViewModel {
                DataSeries = xyDataSeries,
                StyleKey = "LineSeriesStyle"
            };
        }


        if (type == typeof(XyScatterRenderableSeriesViewModel))
        {
            return new XyScatterRenderableSeriesViewModel {
                DataSeries = xyDataSeries,
                StyleKey = "ScatterSeriesStyle" };
        }

        throw new NotImplementedException("Unsupported Series Type");
    }

And the style named for scatter which is store in application resources, same as other style

<Style x:Key="LineSeriesStyle" TargetType="s:FastLineRenderableSeries">
    <Setter Property="Stroke" Value="DarkBlue" />
    <Setter Property="StrokeThickness" Value="3" />
</Style>

<Style x:Key="BarSeriesStyle" TargetType="s:FastColumnRenderableSeries">
    <Setter Property="Stroke" Value="Orange" />
    <Setter Property="StrokeThickness" Value="3" />
</Style>

<Style x:Key="ScatterSeriesStyle" TargetType="s:XyScatterRenderableSeries">
    <Setter Property="Stroke" Value="Yellow" />
    <Setter Property="PointMarkerTemplate">
        <Setter.Value>
            <ControlTemplate>
                <s:EllipsePointMarker Width="5" Height="5" 
                    Fill="Red" 
                   Stroke="#FF000000"
                   StrokeThickness="2"/>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Any idea what I do wrong ?

regards

Version
4
  • You must to post comments
0
0

Try setting the PointMarker in code

new XyScatterRenderableSeriesViewModel {
            DataSeries = xyDataSeries,  
            PointMarker = new EllipsePointMarker() { Width = 5, Height = 5, Fill = ... } 
 }

If that works you have isolated that something is wrong with your style. Either the style isn’t applied, or the template isn’t properly applied

  • sc sc
    Hi, I just try by code as you suggest and it works. What could be wrong in the style as I took it from your sample ?
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.