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

0 votes
0 answers
11 views

Maybe this isn’t a quirk, but I wanted to point this out. (No pun intended on points.)

So, I was in search of a way to keep a series selected after the user drags a point or double-clicks on a point in that series.

I found a way, but it doesn’t really make sense to me why it works.

Before, I was using the following code and it would keep the series selected, but it would also select another series with the index of hitTestPoint.DataSeriesIndex. (Which makes sense.) But I wasn’t sure why the series with the point was staying selected too.

    private void _sciChart_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
    {
        if (SelectedSeries == null) { return; }

        HitTestInfo hitTestPoint = SelectedSeries.HitTest(rawPoint: MousePosition, hitTestRadius: 10);

        if (hitTestPoint.IsHit)
        {
            RenderableSeries[hitTestPoint.DataSeriesIndex].IsSelected = true;
        }
    }

However, by adding the IsSelected = false part right after setting it to true works like a charm. And I get why the series with the same index as DataSeriesIndex becomes selected/unselected, but I don’t get why the series with the point also stays selected.

Here’s my “hack” to make it work as I want:

    private void _sciChart_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
    {
        if (SelectedSeries == null) { return; }

        HitTestInfo hitTestPoint = SelectedSeries.HitTest(rawPoint: MousePosition, hitTestRadius: 10);

        if (hitTestPoint.IsHit)
        {
            RenderableSeries[hitTestPoint.DataSeriesIndex].IsSelected = true;
            RenderableSeries[hitTestPoint.DataSeriesIndex].IsSelected = false;
        }
    }

Anyway, it works so that’s great. But I just wanted to let you know about this and maybe give me some insight into why this works or if there’s a “cleaner” way.

Thanks!

  • Greg Knox asked 21 hours ago
  • last active 21 hours ago
0 votes
0 answers
18 views

Hallo,

I updated to version 4.2.0.9.172 Runtime 4.0.30319. From that point on I receive this error coming from my VerticalLineAnnotationStyle:
System.InvalidOperationException: ‘Unable to Apply the Control Template. PART_LabelsPanel is missing or of the wrong type’

So I added this to the template in my style:

And now I get this error: System.ArgumentOutOfRangeException: ‘Specified argument was out of the range of valid values.’

What should the Template of VerticalLineAnnotation be?

My current syle:

        <Style x:Key="CommentAnnotationStyle" TargetType="pp:CustomCommentAnnotation">
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="StrokeThickness" Value="1.0" />
        <Setter Property="LabelTextFormatting" Value="{Binding DefaultTextFormatting, Mode=OneWay, RelativeSource={RelativeSource Self}}" />
        <Setter Property="IsHitTestVisible" Value="True"/>
        <Setter Property="Stroke" Value="Blue"/>
        <Setter Property="StrokeDashArray" Value="1 0 0 1"/>
        <!---->
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="s:VerticalLineAnnotation">
                    <Grid x:Name="PART_LineAnnotationRoot" ShowGridLines="False">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <Line x:Name="PART_GhostLine"
                              MouseDown="PART_GhostLine_MouseDown"
                              Grid.Row="1"
                              Grid.Column="1"
                              HorizontalAlignment="Center"
                              Stretch="Fill"
                              Stroke="Transparent"
                              StrokeThickness="8"
                              IsHitTestVisible="True"
                              Cursor="Hand"
                              ToolTip="{Binding Comment, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type pp:CustomCommentAnnotation}}}"
                              X1="0"
                              X2="0"
                              Y1="0"
                              Y2="1" /><!-- after Transparent StrokeThickness="{z:Static Member=visuals:ManipulationMargins.AnnotationLineWidth}"-->

        <Line x:Name="PART_Line"
                              MouseDown="PART_GhostLine_MouseDown"
                              Grid.Row="1"
                              Grid.Column="1"
                              HorizontalAlignment="Center"
                              Stretch="Fill"
                              Stroke="{TemplateBinding Stroke}"
                              StrokeDashArray="{TemplateBinding StrokeDashArray}"
                              StrokeEndLineCap="Square"
                              StrokeStartLineCap="Square"
                              StrokeThickness="{TemplateBinding StrokeThickness}"
                              IsHitTestVisible="True" 
                              Visibility="{Binding LineVisible, Converter={StaticResource BoolToVis},
                                        RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type my:STMainWindow}}}"
                              Cursor="Hand"
                              X1="0"
                              X2="0"
                              Y1="0"
                              Y2="1" />

        <Grid x:Name="PART_LabelsPanel"/>
        <Label></Label>
        </Grid>
        </ControlTemplate>
        </Setter.Value>
        </Setter>
    </Style>

Regards,
Jason

  • bochelie asked 2 days ago
  • last active 2 days ago
0 votes
42 views

Am encountering the following runtime error despite explicitly adding a numeric y-axis with Id “DefaultAxisId” to the AxisCollection in my view model that is bound to YAxes:

Exception thrown: ‘System.InvalidOperationException’ in SciChart.Charting.dll
SciChartSurface didn’t render, because an exception was thrown:
Message: AxisCollection.GetAxisById(‘DefaultAxisId’) returned no axis with ID=DefaultAxisId. Please check you have added an axis with this Id to the AxisCollection

Stack Trace: at SciChart.Charting.Model.AxisCollection.GetAxisById(String axisId, Boolean assertAxisExists)
at A.IJ.M(ISciChartSurface D, RenderPassInfo I, IRenderContext2D J)
at A.IJ.RenderLoop(IRenderContext2D renderContext)
at SciChart.Charting.Visuals.SciChartSurface.DoDrawingLoop()

To test, I added the following Y-Axis within my view model constructor:

YAxes.Add(new NumericAxis()
        {
            Id = "DefaultAxisId",
            Visibility = Visibility.Hidden
        });

Why is this error still thrown?

  • bbmat asked 3 days ago
  • last active 2 days ago
0 votes
29 views

I have two separate view models each representing a chart pane. I explicitly do not share the MouseEventGroup Id, and expected none of the ChartModifiers to be shared. However, the MouseWheelZoomModifier is shared. When I zoom via mouse wheel on one chart the other chart is zoomed instantaneously as well. Visible Range is shared but what bothers me is that MouseWheelZoomModifier syncs but other modifiers do not. Is that intended? Desired is to not have any modifiers sync unless I share an identical MouseEventGroup Id.

Here is the code that produces this problem:

<s:SciChartSurface
                x:Name ="Surface"
                Padding="5"
                YAxes="{Binding YAxes, Mode=OneWay}"
                RenderableSeries="{s:SeriesBinding ChartSeries}"
                s:SciChartGroup.VerticalChartGroup="{Binding VerticalChartGroupId}"
                s:ThemeManager.Theme = "{Binding ChartTheme}">

        <s:SciChartSurface.Style>
            <Style TargetType="{x:Type s:SciChartSurface}">
                <Style.Triggers>
                    <!-- Enable DirectX only when not in designer -->
                    <Trigger Property="componentModel:DesignerProperties.IsInDesignMode" Value="False">
                        <Setter Property="s3D:DirectXHelper.TryApplyDirectXRenderer" Value="True" />
                        <Setter Property="s3D:DirectXHelper.FallbackType" Value="{x:Type s:HighQualityRenderSurface}" />
                    </Trigger>
                </Style.Triggers>
            </Style>
        </s:SciChartSurface.Style>

        <s:SciChartSurface.XAxis>
            <s:CategoryDateTimeAxis Id="XAxisId" Visibility="Visible" AutoRange="Never" GrowBy="0.01, 0.01" VisibleRange="{Binding XAxisVisibleRange, Mode=TwoWay}" VisibleRangeLimitMode="MinMax" LabelProvider="{Binding LabelProvider}"/>
        </s:SciChartSurface.XAxis>

        <s:SciChartSurface.ChartModifier>
            <s:ModifierGroup>

                <!--s:MouseManager.MouseEventGroup="{Binding SharedMouseGroupId}"-->

                <s:CursorModifier ReceiveHandledEvents="True" SourceMode="AllSeries" UseInterpolation="True" ShowAxisLabels="True" ShowTooltip="False"/>
                <s:ZoomPanModifier ReceiveHandledEvents="True" ZoomExtentsY="False" XyDirection="XDirection" ClipModeX ="ClipAtExtents" ExecuteOn ="MouseLeftButton" />
                <s:RubberBandXyZoomModifier ReceiveHandledEvents="True" IsAnimated = "False" IsXAxisOnly = "True" ExecuteOn = "MouseRightButton"/>
                <s:MouseWheelZoomModifier ReceiveHandledEvents="True" XyDirection = "XDirection"/>
                <s:ZoomExtentsModifier ReceiveHandledEvents="True" IsAnimated = "False" ExecuteOn = "MouseDoubleClick"/>
                <s:RolloverModifier ReceiveHandledEvents="True" x:Name="RollOverModifier" DrawVerticalLine="False" ShowTooltipOn="Never" SourceMode="AllSeries"/>

            </s:ModifierGroup>
        </s:SciChartSurface.ChartModifier>

    </s:SciChartSurface>

Edit:

In addition, I am having an issue with the following as well: I use an x-Axis Visible Range property in the the view model, that serves as data context to the rendering surface, I noticed the following issue: MouseWheelZoomModifier causes “_xAxisVisibleRange != value” inside the property setter to ALWAYS evaluate false even when zooming in and out with the mouse wheel. All other chart modifiers cause the inequality to evaluate true when the visible range changes due to applying the chart modifiers. A workaround would be to instead test for “_xAxisVisibleRange.Min != value.Min || _xAxisVisibleRange.Max != value.Max” but it is nonetheless an inconsistency.

Please see below code snippet to illustrate the issue:

public IRange XAxisVisibleRange
    {
        get { return _xAxisVisibleRange; }
        set
        {
            //this is only invoked by its own pane view model (never by an outside pane view model)
            if (_xAxisVisibleRange != value)
            {
                _xAxisVisibleRange = value;
                RaisePropertyChanged("XAxisVisibleRange");


            }
        }
    }
  • bbmat asked 3 days ago
  • last active 2 days ago
0 votes
24 views

For my chart, I create a TimeSpanAxisViewModel with a VisibleRangeLimit like this…

VisibleRange = new TimeSpanRange(new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 30))    
VisibleRangeLimit = new TimeSpanRange(new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 30))
AutoRange = AutoRange.Never

Which properly shows the chart as having 30 seconds of time. Data is added to the chart and it displays as expected.

However, once that data reaches the 30-second limit I’m trying to increase the range by 30 more seconds.

I have a timer that evaluates the elapsed time of a Stopwatch and when that Stopwatch is greater than the current limit (30 seconds) I add to the maximum limit.

Kind of like this…

// If the stopwatch is greater than current range
if (MyStopwatch.Elapsed.TotalSeconds > VisibleRangeSeconds) {

    VisibleRangeSeconds += 30;

    TimeSpan minimumTime = new TimeSpan(0);
    TimeSpan maximumTime = new TimeSpan(0, 0, VisibleRangeSeconds);

    XAxes[0].VisibleRange = new TimeSpanRange(min: minimumTime, max: maximumTime);
    XAxes[0].VisibleRangeLimit = new TimeSpanRange(min: minimumTime, max: maximumTime);

    MySciChart.ChartModifier.ParentSurface.InvalidateElement();
}

I also noticed that VisibleRangeLimit was being updated after the Stopwatch became longer but VisibleRange was staying the same. It wasn’t being updated and I’m not sure why.

What could I be missing that would make the chart grow to the new maximum time?

  • Greg Knox asked 4 days ago
  • last active 3 days ago
0 votes
22 views

I want to write the X axis vertically, as shown in the following image.
How should I do it?

0 votes
28 views

Is it possible to remove the number on the bottom left of the chart seen in he attachment?

0 votes
0 answers
30 views

I’m rebuilding a program to adhere to MVVM and so I’m trying to figure out little tricks to do things I did previously in the code-behind.

I’d like to be able to right-click on a selected series and add a point at that location. I’m doing this in my previous application but I’m not too sure the best route to take with the MVVM application.

I’m currently selecting a series with the SeriesSelectionModifier, but I’m also not sure if there’s a “SelectedSeries” property I can get from the modifier either.

Maybe a Trigger that detects a right mouse click on a selected series that calls a command to add the point?

Or is there just not a way to do this with the chart and I need to rely on subscribing to events?

Thanks!

Answer:

I created a property named SelectedSeries which looks like this…

    public IRenderableSeries SelectedSeries
    {
        get
        {
            if (SciChart.SelectedRenderableSeries.Count > 0)
            {
                return SciChart.SelectedRenderableSeries[0];
            } else
            {
                return null;
            }
        }
    }

Then, I created a MouseRightButtonUp event to see if I right-clicked on SelectedSeries. If so, it adds a point. If I clicked on an existing point, it deletes that point.

    private void _sciChart_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
    {
        if (SelectedSeries != null)
        {
            HitTestInfo hitTestToDelete = SelectedSeries.HitTest(rawPoint: MouseDownPosition, hitTestRadius: 10);

            if (hitTestToDelete.IsHit == true)
            {
                // Do nothing if the first or last point is hit
                if (hitTestToDelete.DataSeriesIndex == 0 || hitTestToDelete.DataSeriesIndex == SelectedSeries.DataSeries.Count - 1)
                {
                    return;
                }

                // Delete point
                DeletePoint(point: hitTestToDelete);
            } else
            {
                // Add point if hitting series
                HitTestInfo hitTestToAdd = SelectedSeries.HitTest(rawPoint: MouseDownPosition, hitTestRadius: 10, interpolate: true);

                if (hitTestToAdd.IsHit == true)
                {
                    // Add point
                    AddPoint(point: hitTestToAdd);
                }
            }
        }
    }
  • Greg Knox asked 1 week ago
  • last active 4 days ago
0 votes
40 views

Is it possible to get a legend for each z-axis line with a waterfall 3d graph. And show/hide each line via the legends?

0 votes
42 views

I’ve been using this chart for a few months now and yesterday ran into a problem with the Y-axis. I’m sure this is nothing more than my lack of understanding on multiple axes.

I have a need to add a 2nd Y axis and I’m not doing something right. My application is using MVVM to bind series to my chart. So far I have been adding data to my chart using the methods described here…

https://www.scichart.com/documentation/v5.x/webframe.html#Tutorial%2003b%20-%20Adding%20Series%20to%20a%20Chart%20with%20MVVM.html

I’ve read the documentation for adding data on multiple axes and have run into a wall. I have cases where I will need to have data only on one axis and other times when I will have data on both. For now I’m just setting up my 2 series in the XAML but not adding data to the 2nd Y axis yet. When I do this my series doesn’t show on the chart anymore.

Here is what I had when it worked…

            <s:SciChartSurface.YAxes>

            <!-- Dose Axis -->
            <s:NumericAxis AxisTitle="Dose (%)" AutoRange="{Binding Path=YAutoRange}"
                           AxisAlignment="Left"
                           FontFamily="Arial"
                           GrowBy="0.05, 0.05" 
                           Style="{DynamicResource ResourceKey=DoseAxisStyle}"
                           s:CursorModifier.AxisLabelContainerStyle="{StaticResource CursorModAxisLabelStyle}"
                           s:CursorModifier.AxisLabelTemplate="{StaticResource CursorModAxisLabelTemplate}" />


        </s:SciChartSurface.YAxes>

And here is what I have now…

            <s:SciChartSurface.YAxes>

            <!-- Dose Axis -->
            <s:NumericAxis AxisTitle="Dose (%)" AutoRange="{Binding Path=YAutoRange}"
                           AxisAlignment="Left"
                           FontFamily="Arial"
                           GrowBy="0.05, 0.05" 
                           Style="{DynamicResource ResourceKey=DoseAxisStyle}"
                           s:CursorModifier.AxisLabelContainerStyle="{StaticResource CursorModAxisLabelStyle}"
                           s:CursorModifier.AxisLabelTemplate="{StaticResource CursorModAxisLabelTemplate}" />

            <!-- 2nd Y Axis -->
            <s:NumericAxis AxisTitle="{Binding Path=RightAxisTitle}" 
                           Id="YAxis2"
                           AxisAlignment="Right"
                           Visibility="{Binding Path=RightAxisVisibility}"
                           AutoRange="{Binding Path=YAutoRange}"
                           FontFamily="Arial"
                           GrowBy="0.05, 0.05" 
                           Style="{DynamicResource ResourceKey=DoseAxisStyle}"
                           s:CursorModifier.AxisLabelContainerStyle="{StaticResource CursorModAxisLabelStyle}"
                           s:CursorModifier.AxisLabelTemplate="{StaticResource CursorModAxisLabelTemplate}" />

        </s:SciChartSurface.YAxes>

My model includes code such as…

        // data context for the series(s) on the chart
        public ObservableCollection<IRenderableSeriesViewModel> Measurements
        {
            get { return _measurements; }
            set { SetProperty(ref _measurements, value); }
        }

        private void AddMeasurementSync(MeasurementViewModel measurement, bool clear = false)
        {
        if (clear)
            // clear the profiles, we're only showing one at a time.
            Measurements.Clear();

        // add profile points to the data series
        var xyProfile = new XyDataSeries<double, double>();
        var xyLeft = new XyDataSeries<double, double>();
        var xyRight = new XyDataSeries<double, double>();

        xyProfile.AcceptsUnsortedData = true;
        xyLeft.AcceptsUnsortedData = true;
        xyRight.AcceptsUnsortedData = true;

        // loop the measurement points and fill the series
        foreach (MeasurementPointViewModel point in measurement.Points)
        {
            if (null != point)
                // add the point to the series and add IPointMetaData
                // which says whether or not we are in the penumbra
                xyProfile.Append(
                    point.Distance,
                    point.Dose);
        }

        // create series for profile          
        LineRenderableSeriesViewModel series = new LineRenderableSeriesViewModel()
        {
            StrokeThickness = 2,
            Stroke = measurement.MeasurementColor,
            AntiAliasing = true,
            DataSeries = xyProfile,
        };

        // should be showing points?
        if (ShowPoints)
        {
            series.PointMarker = new EllipsePointMarker()
            {
                Stroke = Colors.Black,
                Fill = Colors.White,
                Width = 6,
                Height = 6,
            };
        }

        // bind to the collection
        Measurements.Add(series);
    }
0 votes
0 answers
32 views

I want to visualize Contour in my application and set the Contour Interval.
But the visualization is not as the expected value.
From your Example application: 3D Charts > Create A Surface Mesh Chart > Surface Mesh 3D With Contours. (Screenshot in attachment)
I have set the Contour Interval property slider to the maximum value (30).
But the result is less than 20, about 10.

How to make the Interval 30, and the visualization is really 30?
Are there any interval scaling property?

0 votes
57 views

Hello. I have a chart with multiple YAxes. One of the YAxis, for example, has an initial range of -10 to 10. I’d like to be able to put my cursor over that axis, scroll the wheel, and have that range increase or decrease depending on which way the user scrolls.

Is there an ability to do that within SciChart’s standard feature, or will something custom need to be written?

  • Greg Knox asked 2 weeks ago
  • last active 2 weeks ago
0 votes
0 answers
71 views

I’d like to rotate after I finish drawing the chart. So I rotated the chart in the following way. (0, 90, 180, 270 Degrees)

SciChart.LayoutTransform = new System.Windows.Media.RotateTransform(0, 0.5f, 0.5f);
SciChart.LayoutTransform = new System.Windows.Media.RotateTransform(90, 0.5f, 0.5f);
SciChart.LayoutTransform = new System.Windows.Media.RotateTransform(180, 0.5f, 0.5f);
SciChart.LayoutTransform = new System.Windows.Media.RotateTransform(270, 0.5f, 0.5f);

And then “TooltipModifier” was also rotated.
But I don’t want to rotate “TooltipModifier.”
When drawing a chart, use “CustomRenderSeries” to rotate using “AxisAlignment” to break the appearance of the chart.

How can you rotate the chart without rotating the “TooltipModifier”?

0 votes
74 views

Hello,
We would like to have a axis behavior similar to Mathlab. The idea is that for the x axis a common exponent is written only once on the right and for the y axis the common exponent is written once on the top of the chart.
Is this possible ?
How can we implement it ?

Thank you !

See figure attached

1 vote
88 views

I have high sampling data.

Data’s diff is 1 ~ 5 tick.

If data append on chart, do not display at each tick.

I want to append 1 tick diff data, and right display.

How to do set chart property or what should I do?

1 vote
80 views

Hi,

is there any way I can set in the XAML that the walls of the axis cube will be visible independent of how the cube is rotated? I’m rendering a drilling hole in 3D space and want to the ground plane(the top wall) and the two back planes to always be visible even if the user rotates the cube so they are infront of the rendered line. Is that possible?

Kind regards,
Karl-Petter

0 votes
83 views

Hi.

I need to know the position of mouse click in axes coordinates. I’ve created a modifier for this:

public class CustomPointSelectionModifier : SeriesSelectionModifier
{
    public override void OnModifierMouseUp(ModifierMouseArgs e)
    {
        base.OnModifierMouseUp(e);
        var xcalc = ParentSurface.XAxes.First().GetCurrentCoordinateCalculator();
        var ycalc = ParentSurface.YAxes.First().GetCurrentCoordinateCalculator();
        var poistionPoint = Mouse.GetPosition((IInputElement)ParentSurface);

        var point = new Point()
        {
            X = xcalc.GetDataValue(poistionPoint.X),
            Y = ycalc.GetDataValue(poistionPoint.Y),
        };
        ((SciChartMvvmBindingsViewModel)DataContext).OnMouseUp(e, point);
    }
}

And it works well if axes width is zero. Otherwise, it provides values shifted by axes width (or height for Y-axis)
In my example, it should add an arrow annotation in a click point. Instead of this, it adds an arrow with shifted coordinates.

What am I doing wrong?
Thanks

0 votes
83 views

I’m using Vertical Slice Modifier but, I don’t want to show Tooltip where series intersects.

How can I hide it?

0 votes
98 views

I am showing a dialog window with a ChartSurface in it. I have a context menu option to export to an image, and on window load I export to an XPS file. The dialog works fine if I do not use either feature, but once I do, I intermittently get an exception when showing the dialog. It appears to regularly take 3 instances of the dialog after the export feature is used to throw the exception, and the exception gets thrown twice the first time, threes times the second time, and so on. Again, if I do not use the export feature (no call to ExportToFile), I do not get any exceptions no matter how many times I show the dialog.

The exception message is “The provided DependencyObject is not a context for this Freezable. Parameter name: context”.

There are no other useful details in the exception from what I can see. Its all pretty abstract WPF stuff. The exported file/image seem to be generated accurately regardless of the exception.

I am using SciChart 4.2.2.9724, Visual Studio 2017 Professional, C#, WPF

Any ideas?

0 votes
123 views

I have a ItemsControl which shows line charts in a vertical uniform grid. Currently they all share the same Annotations collection. The thing I am looking for is if there is a way to control which graph the annotation will show up on. Currently if I add a Text annotation to the collection it shows up on all of the graphs. But it works fine when added a vertical line annotation where I want it to show up on all graphs. I also have the need for a vertical line annotation to show up on only one graph though. If there is not a way to control this what would be the best solution for this?

Thank You

Todd

0 votes
94 views

Hello, dear SciChart!
I try to build one technical indicator (ZigZag) over the market candles.

For candles I use OhlcDataSeries<DateTime, double>;
For indicator I use XyDataSeries<DateTime, double>;

All is good untill I zoom in – my tech indicator disappears. I see, that it happends only when inside the visible range on x-axis remains only 1 point.

All I want is to know, how to always keep zigzag line visible (see my pic #2, please).
For more details, please, see my pictures.

Thanks a lot!

My code to init tech indicator serie:

var cw_zz0 = new XyDataSeries<DateTime, double>() { SeriesName = string.Format("zz") };
        surface.RenderableSeries.Add(new FastLineRenderableSeries()
        {
            Stroke = Colors.Red,
            StrokeThickness = 1,
            DataSeries = cw_zz0,
            IsSelected = true,
            IsVisible = true,
            DrawNaNAs = LineDrawMode.ClosedLines,
            YAxisId = surface.YAxes.First().Id,
            RolloverMarkerTemplate = surface.TryFindResource("MarkerTemplate") as ControlTemplate,
        });

enter image description here
enter image description here

1 vote
129 views

I’m sorry I couldn’t attach images because of security.

Zoom out
VisibleRange X1 min VisibleRange X1 max
    +——————————–+ VisibleRange Y1 min
    |           |
    |           |
    |s=================e|
    |           |
    |           |
    +——————————–+ VisibleRange Y1 max

s : Point Start, e : Point End

In this state, Excute Zoom In Then “s====================e” disappears when the starting point is smaller than min and the end point is greater than max.

Zoom In : “s====================e” disappear
VisibleRange X2 min VisibleRange X2 max
    +——————————–+ VisibleRange Y2 min
    |           |
    |           |
    |           |
    |           |
    |           |
    +——————————–+ VisibleRange Y2 max

I want this chart
VisibleRange X1 min VisibleRange X1 max
    +——————————–+ VisibleRange Y2 min
    |           |
    |           |
    |===================|
    |           |
    |           |
    +——————————–+ VisibleRange Y2 max

How do I draw when a chart is not drawn at the location of a given data using “CustomRenderSeries”?
“====” is a BOX(Rectangle), not a line.

The program source used for coding.
I am currently using
renderableSeries.ResamplingMode = ResamplingMode.None;

// DataInsert.cs

var renderableSeries = new DieRenderableSeries(positionOfDie, _dieLayout);

foreach (var pl in _dieLayout.PlaneLayout._plane)
{
  Plane plane = pl.Value;
  foreach (var ba in plane._bank)
  {
    Bank bank = ba.Value;

    foreach (var matList in bank.NandMat)
    {
      var renderableSeries = new DieRenderableSeries(positionOfDie, _dieLayout);
      List<KeyValuePair<Point, Mat>> matDataList = new List<KeyValuePair<Point, Mat>>();

      foreach (var mat in matList)
      {
        mat.PointType = PointType.Start;
        matDataList.Add(new KeyValuePair<Point, Mat>(new Point(startX + mat.X1, startY + mat.Y1), mat));
      }

      var myList = matDataList.OrderBy(x => x.Key.X)
              .ThenBy(x => x.Key.Y)
               .ToList();

      var dataSeries = new MatDataSeries<double, double> { SeriesName = “Fault” };
      dataSeries.AcceptsUnsortedData = false;
      using (dataSeries.SuspendUpdates())
      {
        for (var i = 0; i < myList.Count(); i++)
        {
          Point myPoint = myList[i].Key;
          dataSeries.Append(myPoint.X, myPoint.Y, myList[i].Value);
        }
      }

      sciChart.RenderableSeries.Add(renderableSeries);
      renderableSeries.DieX = dieX;
      renderableSeries.DieY = dieY;
      renderableSeries.DataSeries = dataSeries;
      renderableSeries.CountOfRenderableSeries = dataSeries.Count;
      renderableSeries.ResamplingMode = ResamplingMode.None;
    }
  }
}

// CustomRenderableSeries.cs

for (var i = 0; i < _series.Count; i++)
{
  var data = renderPassData.PointSeries[i];
  var mat = (Mat)DataSeries.Metadata[data.Index];

  Point point = GetCoordinatesFor(data.X, data.Y);
  Point point2 = GetCoordinatesFor(data.X + mat.Width, data.Y + mat.Height);

  IBrush2D brush = _dicBrush[mat.TypeX];
  var pen = _bgndPens[mat.IsRedun && IsRedunVisibled ? 1 : 0];

  drawingHelper.DrawBox(point, point2, brush, pen, 0);
}

0 votes
166 views

Hello SciChart team,

How do I serialize custom tick placement and labels, generated by TickProviderAPI and LabelProvider? Actually, the main problem is that I need to export high quality (i.e. higher than actual figure size on screen) PNG images in MVVM application and method ExportToFile(fileName, ExportType.Png, false, new Size(…, …)) produces axis ticks and labels as if they were controled by original MinorDelta and MajorDelta parameters. ExportToFile() without size parameter produces output correctly, so that must be due to not-serialized TickProvider and LabeProvider properties (?), which in exported serialized surface string does not exist.

Thank you!

0 votes
150 views

I am doing SciChart development with MVVM.
I generate RenderableSeries with ViewModel, View uses Bind it and uses it.

TooltipModifier is used for tooltip display.
In this application, I want to customize and display the tooltip.

To customize using the TooltipTemplate of TooltipModifier,
It was described in the following URL.
In this method, TooltipModifier.TooltipTemplate is described in XAML in View resource.
Therefore, it is not possible to specify TooltipModifier.TooltipTemplate from ViewModel.

If you generate RenderableSeries with ViewModel,
How should I specify the TooltipTemplate?

0 votes
160 views

Hi, I want to know buffer structure of 2d fastline.

I use very huge data per line.(maybe about 30,000 points/1 sec are appended to a line.)

But Memory usage is different than expected.

I use fifocapacity, and It is realtime graph.

Appending data, the memory usage increases too much.

Especially, It use more memory when drawing more lines.

For example,
Assuming one line uses 100mb, the five lines use 5000mb not 500mb.

Is it right??

  • CholJin Ko asked 2 months ago
  • last active 1 week ago
0 votes
143 views

I was curious, and had mentioned this in another thread, but verified what I thought. My first SciChart instance is drawing in DirectX and subsequent charts are not. Please see attached. Each chart is being created and placed inside a tabitem.

I used the suggested annotation to show the version being used (from the support forum) and found why my images are not as crisp in most of my charts.

s3d:DirectXHelper.TryApplyDirectXRenderer="True"
s3d:DirectXHelper.FallbackType="{x:Type s:HighQualityRenderSurface}"
1 vote
184 views

In the designer I’m seeing this. It doesn’t seem to affect the application; however, I can’t see any of my XAML in the designer because of this problem. Also, I’m having a strange intermittent issue with multiple instances of the chart in my UI not being as smooth and sharp after adding a few charts.

DllNotFoundException: Unable to load DLL ‘sharpdx_direct3d11_1_effects_x86.dll’: The specified module could not be found. (Exception from HRESULT: 0x8007007E)

at SciChart.Drawing.DirectX.Context.D3D11.DirectXHelper.LTC.J(Object D, DXErrorEventArgs I)
at SciChart.Drawing.DirectX.Context.D3D11.Direct3D11RenderSurface.RecreateSurface()
at SciChart.Drawing.Common.RenderSurfaceBase.RenderSurfaceSizeChanged(Object sender, SizeChangedEventArgs sizeChangedEventArgs)
at System.Windows.SizeChangedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at System.Windows.FrameworkElement.OnRenderSizeChanged(SizeChangedInfo sizeInfo)
at System.Windows.ContextLayoutManager.fireSizeChangedEvents()
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.UIElement.UpdateLayout()

Here’s the XAML for my chart

        <!-- Chart  -->
    <s:SciChartSurface Grid.Row="1" Grid.Column="1"                                   
                       Name="DoseChart"
                       s3d:DirectXHelper.TryApplyDirectXRenderer="True"
                       s3d:DirectXHelper.FallbackType="{x:Type s:HighQualityRenderSurface}"
                       RenderableSeries="{s:SeriesBinding Measurements}"
                       Annotations="{s:AnnotationsBinding Annotations}"
                       Style="{StaticResource ResourceKey=SurfaceStyle}"                                                      
                       GridLinesPanelStyle="{StaticResource ResourceKey=GridLinesPanelStyle}">


        <!-- Distance Axis-->
        <s:SciChartSurface.XAxis>
            <s:NumericAxis AxisTitle="Distance (cm)"
                           FontFamily="Arial" FontSize="12"
                               FlipCoordinates="False"
                               GrowBy="0.05, 0.05"
                               ScientificNotation="None" 
                               s:CursorModifier.AxisLabelContainerStyle="{StaticResource CursorModAxisLabelStyle}"
                               s:CursorModifier.AxisLabelTemplate="{StaticResource CursorModAxisLabelTemplate}"
                               Style="{DynamicResource ResourceKey=DistanceAxisStyle}" />
        </s:SciChartSurface.XAxis>

        <!-- Dose Axis -->
        <s:SciChartSurface.YAxis>
            <s:NumericAxis AxisTitle="Dose (%)"
                           FontFamily="Arial"
                               GrowBy="0.05, 0.05" 
                               Style="{DynamicResource ResourceKey=DoseAxisStyle}"
                               s:CursorModifier.AxisLabelContainerStyle="{StaticResource CursorModAxisLabelStyle}"
                               s:CursorModifier.AxisLabelTemplate="{StaticResource CursorModAxisLabelTemplate}" />
        </s:SciChartSurface.YAxis>

        <!-- Modifiers (zoom, panning, tooltips, cursor) -->
        <s:SciChartSurface.ChartModifier>
            <s:ModifierGroup>
                <s:RubberBandXyZoomModifier IsAnimated="True" IsXAxisOnly="False" />
                <s:ZoomExtentsModifier ExecuteOn="MouseDoubleClick" />
                <s:ZoomPanModifier ExecuteOn="MouseRightButton" />
                <s:MouseWheelZoomModifier ActionType="Zoom" XyDirection="XYDirection" />
                <s:XAxisDragModifier DragMode="Scale" />
                <s:YAxisDragModifier DragMode="Scale" />
                <s:TooltipModifier x:Name="ChartTooltip" IsEnabled="True" />
                <s:CursorModifier x:Name="ChartCursor" IsEnabled="False" ShowAxisLabels="True" Foreground="Red" />
            </s:ModifierGroup>
        </s:SciChartSurface.ChartModifier>

    </s:SciChartSurface>
0 votes
165 views

Hi I am trying to create a vertical line annotation with MVVM annotationsbinding – this is due to having a chart group with 2 SciChartSurfaces sharing one X axis.

I have added a VerticalLineAnnotationViewModel to my

ObservableCollection Annotations

I would like the user to be able to create a vertical line with two labels, one with the X1 position and the other with some custom text.

I have tried adding an ObservableCollection AnnotationLabels to the VerticalLineAnnotationViewModel during instantiation however they don’t seem to appear.

As an alternative I tried a CustomAnnotation called CustomVerticalLine which inherited CustomAnnotation and then created a CustomVerticalLineViewModel which inherited CustomAnnotationViewModel and then overrode the ViewType to CustomVerticalLine. This displayed the two labels but then I couldn’t bind to the X1 value or the text property.

What am I doing wrongly, could anyone help please?

Thanks

0 votes
157 views

I want to display a character string on the X axis.

DataSeries can be realized by using XyDataSeries <sting, double> in ViewModel.

What is used for SciChartSurface.XAxis in View?

0 votes
153 views

I have a DateTime X Axis, to which I have added a custom label provider – namely to convert UTC display time to LocalTime.

This works just fine for the AxisLabels, but I also have vertical line annotations and they are NOT using the label provider and are thus showing UTC times.

Is there any way to make the vertical line annotations use the same label provider? Or some way to override the vertical line annotation label function to set the time to local?

Picture Attached.

0 votes
142 views

I want to display the entire chart from ViewModel with MVVM.

I am developing it with MVVM.
In View, if you want to display the whole chart by double clicking the mouse, it can be realized by using ZoomExtentsModifier.

I want to realize the same thing from ViewModel.

How can I do it?

0 votes
139 views

I have several BandRenderableSeriesViewModel in my chart that the user can click on to select. The issue is that they pop up into the foreground when selected and hide everything else that is now behind them. Is there a way to keep them where they are upon selection?

0 votes
150 views

Hi!

I’ve tried to access the values to print them in a different view, but I cant reach them. So my question is there a specific way to reach them?

1 vote
188 views

I’m trying to update to the latest nuget package and getting

Severity Code Description Project File Line Suppression State
Error Failed to fetch results from V2 feed at ‘https://nuget.telerik.com/nuget/Packages(Id=’SciChart’,Version=’5.2.2.11833′)’ with following message : Response status code does not indicate success: 401 (Logon failed.).
Response status code does not indicate success: 401 (Logon failed.).

I haven’t changed anything that I’m aware of. Ideas?

0 votes
185 views
      <s:SciChartSurface.Annotations>
            <s:BoxAnnotation X1="25" X2="75" Y1="0" Y2="100" Background="#33FFFFFF" 
                BorderBrush="#55FFFFFF" BorderThickness="3" Padding="5">

                <s:BoxAnnotation.Template>

                    <ControlTemplate TargetType="s:BoxAnnotation">


                        <Border x:Name="PART_BoxAnnotationRoot" 
           Margin="{TemplateBinding Margin}"
           Background="{TemplateBinding Background}"
           BorderBrush="{TemplateBinding BorderBrush}"
           BorderThickness="{TemplateBinding BorderThickness}"
           CornerRadius="{TemplateBinding CornerRadius}">
                            <Viewbox Margin="{TemplateBinding Padding}" >
                                <TextBlock Text="Hello CustomAnnotation World!"></TextBlock>

                            </Viewbox>
                        </Border>

                    </ControlTemplate>
                </s:BoxAnnotation.Template>
            </s:BoxAnnotation>
        </s:SciChartSurface.Annotations>

by below tag or a code?

  • bar asked 2 months ago
  • last active 2 months ago
0 votes
193 views

I want to put one vertical line to chart, when mouse left button click inside the chart.
And, I want to put vertical line where nearest plotted X value to mouse cursor location in the chart.
No interpolation.

  • Also, I’m using RubberBandXyZoomModifier ExecuteOn=”MouseLeftButton”
    and

  • ZoomPanModifier ExecuteOn=”MouseRigthButton”

What is the best Modifier to use?
And how can it set like that?

1 vote
187 views

enter image description here

we want z axis up but when we draw Y axis come up hot to solve this

        short[] shortArrayz;
        int lengthz;
        short[,] shortArray = new short[100, 15];
        using (BinaryReader b = new BinaryReader(
                    File.Open("F971-181223-10.MNZ", FileMode.Open)))
        {
            // 2.
            // Position and length variables.
            int pos = 0;
            // 2A.
            // Use BaseStream.

            //    pos += sizeof(int);
            //  pos += sizeof(int);
            lengthz = (int)b.BaseStream.Length;
            shortArrayz = new short[lengthz];


            //    Console.WriteLine(length);
            while (pos < lengthz)
            {
                // 3.
                // Read integer.

                /*

                for (int i = 0; i < 100; i++)
                {
                    for (int j = 0; j < 15; j++)
                    {

                        shortArray[i, j] = b.ReadInt16();
                        Console.WriteLine(shortArray[i, j]);
                    }
                }
                */

                shortArrayz[pos] = b.ReadInt16();


                // 4.
                // Advance our position variable.
                pos += sizeof(short);
            }
        }


        //100x15 lik dosya için        
        int xSize = 15;
        int ySize = 100;


        var meshDataSeries = new UniformGridDataSeries3D<double>(xSize, ySize)
        {
            SeriesName = "Uniform Surface Mesh",
        };




        int h = 0;

        for (int x = 0; x <xSize; x++)
            for (int y = 0; y < ySize; y++)
        {             
            {
                double z =(double) shortArrayz[h];
            meshDataSeries[y, x] = z;

                h += sizeof(short);               
            }
        }


        // Assign the DataSeries to the char
        surfaceMeshRenderableSeries.DataSeries =meshDataSeries;

2) In contour graph values is coorect but seems like it is sliced how to solve this?

Codes are attached

  • bar asked 2 months ago
  • last active 2 months ago
1 vote
0 answers
185 views

Hello everyone,

I have a chart which has data added to its plots at inconsistent time intervals.
My intention is to be able to limit the displayed data by their x-values, for example only showing the last 60 seconds. At the same time I wish to be able to zoom/pan back to the old data, so I can not discard it, and from what I saw “VisibleRangeLimit” did not work this way either, as it limited every zoom or pan action to the given range limit. Mainly I need the auto ranging to limit the display to my limits (and return the graph to its scrolling mode), while every other zoom/pan interaction stops the scrolling without being limited.

The solution I came up with for this is to “move” the VisibleRange of the axis whenever new data points outside the current displayed range are added to the chart’s plots. (For example if a point is plotted at 61 seconds, the VisibleRange moves to min=1 and max=61.)

I made this into an axis class, which inherits the NumericAxis and uses DataRangeChanged to change the VisibleRange on data changes and VisibleRangeChanged to react to auto ranging and zooming/panning.

private void UpdateVisibleRange()
{
    DoubleRange visibleRange = (DoubleRange)GetMaximumRange();
    visibleRange.Min = visibleRange.Max > ViewLimit ? visibleRange.Max - ViewLimit : 0;
    VisibleRange = visibleRange;
}

// DataRangeChanged += DataRangeChangedHandler;
private void DataRangeChangedHandler(Object sender, EventArgs e)
{
    if (IsAutoRangeActive)
    {
        UpdateVisibleRange();
        IsAutoRangeActive = true;
    }
}

// VisibleRangeChanged += VisibleRangeChangedHandler;
private void VisibleRangeChangedHandler(Object sender, VisibleRangeChangedEventArgs e)
{
    if (base.AutoRange == AutoRange.Always)
    {
        base.AutoRange = AutoRange.Never;
        UpdateVisibleRange();
        IsAutoRangeActive = true;
    }
    else if (IsAutoRangeActive)
    {
        IsAutoRangeActive = false;
    }
}

(Only relevant code shown.)

How it works:
If the VisibleRange of the axis is changed through other means than new data being plotted or AutoRange being set to Always, a zoom/pan action is assumed and IsAutoRangeActive gets set to false.
If AutoRange is set to Always it causes the VisibleRange to change, which causes a VisibleRangeChanged event to trigger, activating IsAutoRangeActive and recalculating the VisibleRange to fit the desired view limit.
IsAutoRangeActive being true causes data range changes from new data to call UpdateVisibleRange, which moves the displayed range according to the view limit. As changes to the VisibleRange cause a VisibleRangeChanged event to trigger, which sets IsAutoRangeActive to false, IsAutoRangeActive needs to be reset to true after the VisibleRange has been updated in the handler.

The problem:
It all seemed to work fine until I noticed that this method does not update the actually displayed axis VisibleRange to the latest range. It uses the previous VisibleRange whenever the DataRange changes, despite VisibleRange apparently being set to the correct values. For example, if the previous range was at “min=1, max =61”, and the next is at “min=2, max=62”, the chart’s x-axis would display “min=1, max=61” instead.
It seems that “VisibleRange = visibleRange;” in UpdateVisibleRange, called from DataRangeChangedHandler, does not update the displayed range.
It works fine if the change is trigger by setting AutoRange to Always, and the x-axis’ VisibleRange corrects itself when the y-axis is modified.

(Overall this seems like quite a crude solution to me, and I wonder if there isn’t a better way of achieving this. Maybe I overlooked something?)


EDIT:
I got around the issue by using the ViewportManager as recommended and described in Tutorial 06 – Adding Realtime Updates (Scrolling Realtime Charts, see ScrollingViewportManager), though I had to make a change to make it work with my modifiers, which rely on AutoRange being set to “Always” to reset the view to scrolling mode (this way I can reset the x and y axis to extends independently).

private class ScrollingViewportManager : DefaultViewportManager
{
    public Double ViewLimit = 1.0;

    protected override IRange OnCalculateNewXRange(IAxis xAxis)
    {
        DoubleRange dataRange = null;
        if (xAxis.AutoRange == AutoRange.Never) // Zoom/Pan
        {
            dataRange = xAxis?.VisibleRange?.AsDoubleRange();
        }
        else // X-Value limited AutoRange
        {
            dataRange = xAxis?.DataRange?.AsDoubleRange();
            if (dataRange != null)
            {
                dataRange.Min = (dataRange.Max > ViewLimit) ? (dataRange.Max - ViewLimit) : 0.0;
                dataRange.Max = (dataRange.Max == dataRange.Min) ? (dataRange.Min + 1.0) : dataRange.Max;

                Double rangeWidth = dataRange.Max - dataRange.Min;
                dataRange.Min -= (rangeWidth * xAxis.GrowBy.Min);
                dataRange.Max += (rangeWidth * xAxis.GrowBy.Max);
            }
        }
        if (dataRange == null)
            dataRange = new DoubleRange(0.0, ViewLimit);
        return dataRange; 
    }
}

…wonder why I didn’t think of checking for AutoRange instead of ZoomState in the ViewportManager earlier.
While I haven’t tested it thoroughly yet, it seems to work the way I intended it to.
The reason I calculate the GrowBy myself is because it otherwise uses the full DataRange (for example if you had a window of 60 seconds, GrowBy of (0.0, 0.1) and 1000 seconds of data, it would move the data completly out of view, “showing” the timespan from 1040 to 1100).

For me the problem is solved by using a better solution to the actual problem. The question why changes to VisibleRange in the DataRangeChanged-event don’t update the chart is still open though, if someone else comes upon this problem.

0 votes
182 views

Hello,

is it possible to color the curve with different color(s) after specific value(s)
to sumurise the idea, please see the illistustration in this image : https://i.stack.imgur.com/1MWKL.png

Thank you for your support

Regards

0 votes
165 views

Hi ,

Does scichart graph X-Axis supports datetime?

I am getting examples with only NumericAxis examples in internet.

So is it possible to send me some code snippet with datetime with X-Axis.

Thanks & regards,
Kartik K

  • kartik K asked 2 months ago
  • last active 2 months ago
0 votes
191 views

a) change y and z axis order , must be (x,y)->z,
b) the contour graph is sliced in rectangular form when colored, how to solve this?

a) we are trying product, but when I draw surface graph z data come to y axis or tooltip label,I use like this
int xSize = 15;
int ySize = 100;

        var meshDataSeries = new UniformGridDataSeries3D<double>(xSize, ySize)
        {



            SeriesName = "Uniform Surface Mesh",
        };


        int h = 0;

        for (int x = 0; x <xSize; x++)
            for (int y = 0; y < ySize; y++)
        {

            {

                double z =(double) shortArrayz[h];
             meshDataSeries[y, x] = z;

                h += sizeof(short);

            }

b) images attached, contour graph code is atteched

  • bar asked 2 months ago
  • last active 2 months ago
0 votes
193 views

Dear SciChart Team:

I want to have two vertical lines on the graph and get the spacing of the two lines as the mouse moves,
as shown in the attached picture.

Can you provide a simple example showing the architecture of this feature?

  • Johnny Yeh asked 2 months ago
  • last active 2 months ago
0 votes
203 views

I’d like to display the values of series data points using TooltipModifer.

However, if you hold the mouse cursor over the series, the tool tip will be displayed even if there are no data points.

Attach a movie to explain the phenomenon.

I would like to display the tool tip only when I hold the mouse cursor where I have the data point, how can I do it?

0 votes
196 views

As shown in the attached image, if you display a small value with TooltipModifier, it will be rounded to 0 and displayed.

I specified ContentStringFormat with Xaml, but the decimal point is not displayed.

How can I correctly display it?

0 votes
191 views

Hello, I have two questions. The first is we use the annotations to create threshold lines and labels on axis. We would like these lines to appear in the legend data. Is there a way to add them manually to the collection of seriesinfo? What do you recommend.

The second question is that we have a large amount of series data and we were rendering the chart to bitmap. When there is a lot of data the legend is in a scrollview and you cannot see all of it. What do you recommend do in this scenario. Is there a way to make the legend appear in wrap panel?

Thanks, Kurt

0 votes
193 views

Hello. I’d like to be able to double-click on a point, present a prompt to the user to enter in an X and Y value, and then set that point to the new value.

I can handle the prompt but I’m not too sure the best way to setup a double-click on a point to trigger a command.

Any help would be appreciated. Thanks!

  • Greg Knox asked 2 months ago
  • last active 2 months ago
0 votes
234 views

It seems like a memory leak of sciChartSurface. After call Dispose(), some sciChartSurfaces are also refrenced by MouseManager and can’t release.

I also use ants memory profiler, but this web page can’t upload images and attachments, it alerts Forbidden!

The leak instance reference chain is:
MouseManager.I -> Dictionary<string,IList<Mouse.IReceiveMouseEvents>> -> SciChart.Core.Utility.Mouse.IReceiveMouseEvents[] -> SciChart.Charting.ChartModifiers.ModifierGroup -> SciChart.Charting.Visuals.SciChartSurface .

Below is the key code:

>

    private SciChartSurface sciTickPriceChartSurface;
    private FastLineRenderableSeries lastPriceLineRenderableSeries;
    private SciChartSurface sciTickVolumeChartSurface;
    private FastLineRenderableSeries volumeLineRenderableSeries;

    private void LoadSciTickCharts()
    {
        // set sciTickPriceChartSurface xAxis
        var nowDateTime = DateTime.Now; 
        var todayDate = nowDateTime.Date;

        // set sciTickPriceChartSurface
        sciTickPriceChartSurface = new SciChartSurface();
        sciTickPriceChartSurface.ViewportManager = new TickChartViewportManager(todayDate);

        var priceChartXAxis = new DiscontinuousDateTimeAxis
        {
            DrawLabels = false,
            MajorDelta = new TimeSpan(1, 0, 0),
            MinorDelta = new TimeSpan(0,12,0),
            MinimalZoomConstrain = new TimeSpan(1,0,0),
            AutoTicks = false,
            DrawMajorGridLines = true,
            DrawMinorGridLines = false,
            AutoRange = AutoRange.Never,
            LabelProvider = new TickDateTimeAxisLabelProvider(),
            //Calendar = new LSECalendar(), 
            VisibleRange = new DateRange(nowDateTime - new TimeSpan(1,0,0), nowDateTime + new TimeSpan(3,0,0)),
        };

        sciTickPriceChartSurface.XAxes.Add(priceChartXAxis);

        // set sciTickPriceChartSurface yAxis
        var priceYAxis = new NumericAxis
        {
            DrawMajorGridLines = true,
            DrawMinorGridLines = false,
            AutoRange = AutoRange.Always,
            GrowBy = new DoubleRange(0.2, 0.2)
        };
        sciTickPriceChartSurface.YAxes.Add(priceYAxis);

        // lastPriceLineSeries
        lastPriceLineRenderableSeries = new FastLineRenderableSeries
        {
            Stroke = Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF),
            StrokeThickness = 1,
            DataSeries = new XyDataSeries<DateTime, double>(),
        };
        sciTickPriceChartSurface.RenderableSeries.Add(lastPriceLineRenderableSeries);
        CursorModifier.SetSnapToSeries(lastPriceLineRenderableSeries, true);

        // sciTickVolumeChartSurface
        sciTickVolumeChartSurface = new SciChartSurface();

        // set sciTickVolumeChartSurface yAxis
        var volumeYAxis = new NumericAxis
        {
            DrawMajorGridLines = true,
            DrawMinorGridLines = false,
            AutoRange = AutoRange.Always,
            GrowBy = new DoubleRange(0, 0)
        };
        sciTickVolumeChartSurface.YAxes.Add(volumeYAxis);

        var volumeChartXAxis = new DiscontinuousDateTimeAxis
        {
            DrawLabels = true,
            MajorDelta = new TimeSpan(1, 0, 0),
            MinorDelta = new TimeSpan(0, 12, 0),
            MinimalZoomConstrain = new TimeSpan(1, 0, 0),
            AutoTicks = false,
            DrawMajorGridLines = true,
            DrawMinorGridLines = false,
            AutoRange = AutoRange.Never,
            LabelProvider = new TickDateTimeAxisLabelProvider(),
            //Calendar = new LSECalendar()
        };
        sciTickVolumeChartSurface.XAxes.Add(volumeChartXAxis);

        // Bind the VisibleRange of chart2.XAxis.VisibleRange to chart1.XAxis.VisibleRange TwoWay
        var xAxisVisibleRangeBinding = new Binding("VisibleRange")
        {
            Source = priceChartXAxis,
            Mode = BindingMode.TwoWay,
        };
        BindingOperations.SetBinding(volumeChartXAxis, SciChart.Charting.Visuals.Axes.AxisBase.VisibleRangeProperty, xAxisVisibleRangeBinding);

        // volumeLineSeries
        volumeLineRenderableSeries = new FastLineRenderableSeries
        {
            Stroke = Color.FromArgb(0xFF, 0x0, 0xFF, 0xFF),
            StrokeThickness = 1,
            DataSeries = new XyDataSeries<DateTime, long>(),
        };
        sciTickVolumeChartSurface.RenderableSeries.Add(volumeLineRenderableSeries);
        CursorModifier.SetSnapToSeries(volumeLineRenderableSeries, true);

        var grid = new Grid();
        grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(2, GridUnitType.Star) });
        grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) });
        grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });

        var gridSplitter = new GridSplitter
        {
            MinHeight = 4,
            HorizontalAlignment = HorizontalAlignment.Stretch,
            Background = new SolidColorBrush(Color.FromRgb(0xFF, 0xFF, 0x0))
        };

        Grid.SetRow(sciTickPriceChartSurface, 0);
        Grid.SetRow(gridSplitter, 1);
        Grid.SetRow(sciTickVolumeChartSurface, 2);

        grid.Children.Add(sciTickPriceChartSurface);
        grid.Children.Add(gridSplitter);
        grid.Children.Add(sciTickVolumeChartSurface);

        var priceChartSurfaceModifier = new ModifierGroup(

            // Allow pan on Left mouse drag
            new ZoomPanModifier { ExecuteOn = ExecuteOn.MouseLeftButton, ClipModeX = SciChart.Charting.ClipMode.None },
            // <!-- Allow Mousewheel Zoom -->
            new MouseWheelZoomModifier(),
            // <!-- Allow Zoom to Extents on double click -->
            new TickChartZoomExtentsModifier { ExecuteOn = ExecuteOn.MouseDoubleClick },
            // Alow cursor modifier
            new CursorModifier
            {
                SourceMode = SourceMode.AllSeries,
                ShowTooltipOn = ShowTooltipOptions.Always,
                ShowAxisLabels = true,
                ReceiveHandledEvents = true,
                ShowTooltip = true,
                IsEnabled = true,
            }
        );
        sciTickPriceChartSurface.ChartModifier = priceChartSurfaceModifier;

        var volumeChartSurfaceModifier = new ModifierGroup(

            // Allow pan on Left mouse drag
            new ZoomPanModifier { ExecuteOn = ExecuteOn.MouseLeftButton, ClipModeX = SciChart.Charting.ClipMode.None },
            // <!-- Allow Mousewheel Zoom -->
            new MouseWheelZoomModifier(),
            // <!-- Allow Zoom to Extents on double click -->
            new TickChartZoomExtentsModifier { ExecuteOn = ExecuteOn.MouseDoubleClick },
            // Alow cursor modifier
            new CursorModifier
            {
                SourceMode = SourceMode.AllSeries,
                ShowTooltipOn = ShowTooltipOptions.Always,
                ShowAxisLabels = true,
                ReceiveHandledEvents = true,
                ShowTooltip = true,
                IsEnabled = true,
            }
        );
        sciTickVolumeChartSurface.ChartModifier = volumeChartSurfaceModifier;

        var tickChartsMouseEventSharedGroupName = UUIDHelper.CreateUUIDString(false).ToString();
        MouseManager.SetMouseEventGroup(priceChartSurfaceModifier, tickChartsMouseEventSharedGroupName);
        MouseManager.SetMouseEventGroup(volumeChartSurfaceModifier, tickChartsMouseEventSharedGroupName);

        var tickChartSharedGroupName = UUIDHelper.CreateUUIDString(false).ToString();
        SciChartGroup.SetVerticalChartGroup(sciTickPriceChartSurface, tickChartSharedGroupName);
        SciChartGroup.SetVerticalChartGroup(sciTickVolumeChartSurface, tickChartSharedGroupName);

        this.ChartGrid.Children.Clear();
        this.ChartGrid.Children.Add(grid);
    }

    public void Dispose()
    {
        if (isDisposed == true) return;
        isDisposed = true;

        // Don't forget to clear chart grid child list.
        ChartGrid.Children.Clear();

        if (sciTickPriceChartSurface != null)
        {
            // Chart's Dispose method needs to be called when chart is 
            // no longer needed so that all unmanaged resources 
            // (DirectX etc.) are released.
            sciTickPriceChartSurface.ChartModifier?.OnDetached();
            sciTickPriceChartSurface?.Dispose();
            sciTickPriceChartSurface = null;

        }
        if (sciTickVolumeChartSurface != null)
        {
            // Chart's Dispose method needs to be called when chart is 
            // no longer needed so that all unmanaged resources 
            // (DirectX etc.) are released.
            sciTickVolumeChartSurface?.ChartModifier?.OnDetached();
            sciTickVolumeChartSurface?.Dispose();
            sciTickVolumeChartSurface = null;
        }
        GC.SuppressFinalize(this);
    }
0 votes
202 views

I making MVVM application.

I want to Bind SelectedPointMarkers of DataPointSelectionModifier.
But SelectedPointMarkers is readonly property.

Therefore, I couldn’t bind.

How can I bind it?

0 votes
190 views

I want to create a chart with Fixed number of column series with uniform width. For example, X Asis visible range is 0-100 and i want to have 5 column series, 1st column range is 0-20, 2nd columns is 20-40, 3rd column is 40-60 ,4th coulmn is 60-80 and 5th column is 80-100. and there should not be space between columns.I have attached a screen shot of chart that i expected. Please let me know whether its possible?
Thanks

  • deepak b asked 3 months ago
  • last active 2 months ago
Showing 1 - 50 of 2k results