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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

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.