Pre loader

Renderable series paint

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

Answered
1
0

Hello everybody! I’m working with FastMountainrenderableSeries, I need to paint them particularly:
I have got an annotation, that can be moved, and area of renderable series. The area, that is above the annotaion, must be painted with one color, and area below the annotation must be painted with another (see image 1). I know, that it can be done with FastBandRenderableSeries, but I don’t need to have two series. Is there any way to do this with FastMountainSeries or FastBandRenderableSeries and annotation, without extra auxiliary renderable series ?

Thanks in advance.

Images
  • You must to post comments
Best Answer
1
0

Actually, Yuriy is right about PaletteProvider and FastMountainRenderableSeries, but also FastBandRenderableSeries is perfect for this.

If you create an XyyDataSeries, and supply X,Y0 equal to your data and Y1=0.0 at all points, it will then draw a perfect polygon above and below the zero line.

Here’s the example code

Xaml

<Window x:Class="Abt.Controls.SciChart.Wpf.TestSuite.TestCases.MountainWithBandsForAboveBelowZero"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:s="http://schemas.abtsoftware.co.uk/scichart"
        Title="MountainWithBandsForAboveBelowZero" Height="300" Width="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="32"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <StackPanel Orientation="Horizontal">
            <RadioButton Margin="6" IsChecked="{Binding ElementName=mountainSeries, Path=IsVisible, Mode=TwoWay}" Content="Show Mountain"/>
            <RadioButton Margin="6" IsChecked="{Binding ElementName=bandSeries, Path=IsVisible, Mode=TwoWay}" Content="Show BandSeries"/>
        </StackPanel>

        <s:SciChartSurface Grid.Row="1">
            <s:SciChartSurface.RenderSurface>
                <s:HighQualityRenderSurface/>
            </s:SciChartSurface.RenderSurface>

            <s:SciChartSurface.RenderableSeries>
                <s:FastMountainRenderableSeries x:Name="mountainSeries" IsVisible="False" SeriesColor="WhiteSmoke" AreaBrush="#8833FF33"/>
                <s:FastBandRenderableSeries x:Name="bandSeries" SeriesColor="WhiteSmoke" Series1Color="Transparent" BandUpColor="#8833FF33" BandDownColor="#88FF3333"/>
            </s:SciChartSurface.RenderableSeries>
            <s:SciChartSurface.XAxis>
                <s:DateTimeAxis/>
            </s:SciChartSurface.XAxis>
            <s:SciChartSurface.YAxis>
                <s:NumericAxis GrowBy="0.1, 0.1"/>
            </s:SciChartSurface.YAxis>

        </s:SciChartSurface>
    </Grid>
</Window>

Code behind

using System;
using System.Windows;
using Abt.Controls.SciChart.Model.DataSeries;

namespace Abt.Controls.SciChart.Wpf.TestSuite.TestCases
{
    public partial class MountainWithBandsForAboveBelowZero : Window
    {
        public MountainWithBandsForAboveBelowZero()
        {
            InitializeComponent();

            var xyyData = new XyyDataSeries<DateTime, double>();

            var startTime = DateTime.Now;
            for (int i = 0; i < 100; i++)
            {               
                var x = startTime.AddDays(i);
                var y = Math.Sin(i*0.1);

                // Append X=Date, Y=Sinewave, Y1=0.0
                // the y1 value is used by FastBandRenderebleSeries as a threshold to change band colour
                xyyData.Append(x, y, 0.0);
            }

            mountainSeries.DataSeries = xyyData; // Note MountainSeries can consume Xyy or Xy data
            bandSeries.DataSeries = xyyData; // Note Band Series requires Xyy Data
        }
    }
}

Here’s the Result

enter image description here

  • You must to post comments
Good Answer
1
0

Hi Egor,

Thank you for inquiring us. As to your question, it is possible to achieve using the PaletteProvider feature. Please take a look at this article on the topic from our Knowledgebase. Also you could find an example in our online demo.

Hope this helps,

Best regards,
Yuriy

  • Egor
    Hello, thak you for the fast answer. I've already used the PalleteProvider feature in my work, but there is a little trouble (I've attached image , what I have now using this method, and what I must achieve). Need I bind ZeroLineY to annotaion coordinate or there is another way to achive the expected image?
    • Guest
    • 9 years ago
    Yes, binding the ZeroLineY property should do the trick. This seems to be the easiest way. Have you met any complications with it?
  • Egor
    No, I haven't, but I wasn't sure if it was a good approach. Thank you for your advice. I'll write about the result later
  • Egor
    This method works, thank you! But there is one more question: if I want to paint lineseries and area brush with different colors, I need to rewrite draw part in InternalDraw method?
    • Guest
    • 9 years ago
    • 1
    Hi Egor, no, you need not. There is the SeriesColor property, which allows you to specify the color of the outline of MountainSeries, and the AreaColor property, which allows you to specify the color of the polygon below the mountain line.
  • You must to post comments
0
0

Attached imaged to Yuriy’s comment:

Images
  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies