SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & 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

Hi,

I’m creating a custom legend and need to be able to let the user update the color of the entire series. I don’t necessarily need the power if your IPaletteProvider interface, as I don’t need to vary the color within the series.

The documentation states that SeriesInfo.SeriesColor is read/write, but even when I update the source explicitly, the binding does not seem to push the color to the renderable series:

private void cpickSeries_SelectedColorChanged(object sender, RoutedPropertyChangedEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine(e.NewValue);
            
            var cp = sender as Xceed.Wpf.Toolkit.ColorPicker;
            if (cp != null)
            {
                BindingOperations.GetBindingExpression(cp, Xceed.Wpf.Toolkit.ColorPicker.SelectedColorProperty).UpdateSource();
            }

        }

I’ve turned on verbose logging and confirmed that no warnings are being generated by scichart. Am I approaching this incorrectly? Or is there a method I need to call on the series(which I have not found yet). I’ve confirmed the same behavior between XyScatterSeries and FastLine…

Thanks,
Dan.

  • You must to post comments
0
0

Hi there,

SeriesInfo actually exposes the RenderableSeries as IRenderableSeries. You could bind to SeriesInfo.RenderableSeries.SeriesColor in this respect.

Also, with the advent of SciChart v2.x, Scatter series now allow binding of point color to parent series. You can see this demonstrated in this documentation article on PointMarkers.

PointMarker Color Bindings

New to v2.0, the new BasePointMarker derived types can be data-bound to the parent series’ SeriesColor. The DataContext for a point-marker is set to the parent RenderableSeries when the point-marker is assigned, so, to bind to SeriesColor we simply use this:

<s:XyScatterRenderableSeries DataSeries="{Binding DurationSeries[0]}" SeriesColor="Green">
     <s:XyScatterRenderableSeries.PointMarker>
         <!-- Note: PointMarker DataContext is the parent RenderableSeries. You can bind to SeriesColor here -->
         <s:EllipsePointMarker Width="9" Height="9"
                     Fill="{Binding Path=SeriesColor}"
                     Stroke="LightBlue" StrokeThickness="2"/>
     </s:XyScatterRenderableSeries.PointMarker>
 </s:XyScatterRenderableSeries>

Hope this helps 🙂

Andrew

  • dsantimore
    Ah, thank you. I had not noticed the RenderableSeries property of SeriesInfo. That solves that issue. Regarding the scatter series point colors -- no idea what voodoo you did to achieve that, but it works great.
  • Andrew
    lol @ Voodoo :-D The PointMarker types in SciChart v2.x are not control templates, they use the same bitmap rendering engine that the main chart uses. We provide Circle, Square, Triangle, Cross markers and we also created a SpritePointMarker that works in an identical fashion to the old control templated markers. This one does have a bit of magic to allow the old or new syntax. - Andrew
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.