Pre loader

1

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

0 votes

I tried caching IBrush2D into a dictionary, but the problem remained the same. This probably helps by 5-10%, but no more. If I create f.e. 20000 polygons from 80000 points delays are long(1 -1.5s).

is it possible some how to get access CustomPolygonRenderableSeries from CustomPolygonRenderableSeries to manually control the Draw updates. like

protected override void Draw(IRenderContext2D renderContext, IRenderPassData renderPassData)
{
if (skipDrawing) return;
…..

Thanks!

0 votes

Hello Raman,

We discussed your inquiry and would like to provide you with a few recommendations.

  1. Draw all 10000 polygons as a single Renderable Series. Creating each one as a separate Series leads to a huge impact on performance. Additionally, you can get coordinates in one batch calling the GetCoordinates(T[],Double[],Double)) method. Please take a look:
    https://www.scichart.com/documentation/win/current/webframe.html#SciChart.Data~SciChart.Charting.Numerics.CoordinateCalculators.ICoordinateCalculator%601~GetCoordinates.html

  2. Do not allocate a new array on each redraw. You can cache the array instead or use the ArrayPool class. You can find more details in the following Microsoft Learn article:
    https://learn.microsoft.com/en-us/dotnet/api/system.buffers.arraypool-1?view=net-8.0

  3. As Andrew has mentioned, resource creation like Brush or Pen is an expensive
    operation. So you should cache such resources and recreate them only when necessary. E.g. having a collection of such resources:

    var brush = new SolidColorBrush(color);
    using var sBrush = renderContext.CreateBrush(brush, Opacity);

Hope this helps.

With best regards,
Lex S., MSEE
SciChart Technical Support Engineer

  • Lex answered 1 month ago
  • last active 1 month ago
0 votes

Hello,
This sounds as a nice improvement to make. But as of now I can only suggest using the CustomAnnotation for such cases. And I believe there is a way to deal with the resizing issue that you have mentioned.

Here is an example of creating a Scalable Custom Annotation:

  class ScalableAnnotation extends CustomAnnotation {
    private initialWidth: number;
    private initialHeight: number;
    private initialDiff: number;

    public update(
      xCalc: CoordinateCalculatorBase,
      yCalc: CoordinateCalculatorBase,
      xCoordSvgTrans: number,
      yCoordSvgTrans: number
   ): void {
     super.update(xCalc, yCalc, xCoordSvgTrans, yCoordSvgTrans);
     if (!this.initialDiff) {
       this.initialDiff = xCalc.visibleMax - xCalc.visibleMin;
       this.initialWidth = Number.parseFloat(this.svg.getAttribute("width"));
       this.initialHeight = Number.parseFloat(this.svg.getAttribute("height"));
     } else {
       const diff = xCalc.visibleMax - xCalc.visibleMin;
       if (diff !== this.initialDiff) {
       const width = (this.initialWidth * this.initialDiff) / diff;
       const height = (this.initialHeight * this.initialDiff) / diff;
       this.setSvgAttribute("width", width);
       this.setSvgAttribute("height", height);
       let borderX1 = this.getX1Coordinate(xCalc, yCalc) + this.xCoordShift;
       let borderY1 = this.getY1Coordinate(xCalc, yCalc) + this.yCoordShift;
       this.setAnnotationBorders(
         borderX1,
         borderX1 + width,
         borderY1,
         borderY1 + height
       );
      this.updateAdornerInner();
     }
   }
 }
}

// Adding an instance of Scalable Custom Annotation.
// Notice the ScalableAnnotation class used and sizing properties set on the SVG string
const customAnnotation = new ScalableAnnotation({
  x1: 5,
  y1: 6,
  xCoordShift: 0,
  yCoordShift: 0,
  horizontalAnchorPoint: EHorizontalAnchorPoint.Left,
  verticalAnchorPoint: EVerticalAnchorPoint.Top,
  svgString: `<svg width="100" height="100" viewbox="0 0 100 100" preserveAspectRatio="xMinYMin meet"><circle cx="50%" cy="50%" r="50" fill="blue"/></svg>`,
  isEditable: true,
  xCoordinateMode: ECoordinateMode.DataValue,
  yCoordinateMode: ECoordinateMode.DataValue
});

See the Pen
ScalableCustomAnnotation
by SciChart.js Official (@scichart)
on CodePen.

  • Jim Risen answered 2 months ago
  • last active 2 months ago
0 votes

Hello Mr. Nha,

Thanks for your inquiry.
We can recommend you using our Uniform Surface Mesh chart type. Please find the corresponding documentation article below:
https://www.scichart.com/documentation/win/current/webframe.html#The%20SurfaceMesh%203D%20Chart%20Type.html

Please note: to see the C# code sample you can switch to it on the “XAML / CS” tab control.

Additionally, to use SciChart WPF inside your WinForms application you can use a WinForms ElementHost control. Here you can find one of the examples:
https://www.wpf-controls.com/hosting-a-wpf-control-in-winforms/

Hope this helps.

With best regards,
Lex S., MSEE
SciChart Technical Support Engineer

  • Lex answered 2 months ago
0 votes

Hi Ben,

We discussed your inquiry.
To change the zooming direction you can override the OverrideKeyboardAction() method and change ActionTypeProperty and XyDirectionProperty values.
Please find the default OverrideKeyboardAction() method implementation below:

        protected virtual void OverrideKeyboardAction(MouseModifier modifier)
    {
        if (ExecuteWhen == MouseModifier.None)
        {
            if (modifier == MouseModifier.Ctrl)
            {
                this.SetCurrentValue(ActionTypeProperty, ActionType.Pan);
                this.SetCurrentValue(XyDirectionProperty, XyDirection.YDirection);
            }
            else if (modifier == MouseModifier.Shift)
            {
                this.SetCurrentValue(ActionTypeProperty, ActionType.Pan);
                this.SetCurrentValue(XyDirectionProperty, XyDirection.XDirection);
            }
        }
    }

With best regards,
Lex S., MSEE
SciChart Technical Support Engineer

  • Lex answered 2 months ago
0 votes

Hi Andrew,

Just checking in to see if you have any solution for this isssue

Thanks,

Pramod

0 votes

thank you

0 votes

Hi Jongbog Joung,

Thanks for your inquiry.
This is a known issue and it has been already fixed in the SciChart v8.0.0.27776 hotfix build.
Here you can find more information regarding our latest releases:
https://www.scichart.com/changelog/scichart-wpf/

Please try out the latest SciChart version and let us know your feedback.

With best regards,
Lex S., MSEE
SciChart Technical Support Engineer

  • Lex answered 2 months ago
0 votes

I have also forwarded your question regarding server-side licensing to our JS team.

Please note that we recommend separating questions related to different platforms and posting them in the corresponding SciChart forums channels so they can be reviewed and answered faster.
Here you can find our JS forums channel:
https://www.scichart.com/questions/categories/js

With best regards,
Lex S., MSEE
SciChart Technical Support Engineer

  • Lex answered 2 months ago
0 votes

Hi Mohamed,

Hope you are doing well!
I am glad to inform you that we have fixed the reported issue with unsorted data, and the changes are available in the recently published SciChart hotfix build v8.3.1.28072
Here you can find how to get it:
https://www.scichart.com/documentation/win/current/webframe.html#Getting_Nightly_Builds_with_NuGet.html

More details regarding our latest release are available on our Changelog page here:
https://www.scichart.com/changelog/scichart-wpf/

Please try out the new SciChart version and let us know your feedback.

With best regards,
Lex S., MSEE
SciChart Technical Support Engineer

  • Lex answered 2 months ago
  • last active 2 months ago
0 votes

This is a known issue due to the way we detect if the axis is in its default state. We are taking a look to see if there is a simple and safe way we can sort out.
Regards
David

1 vote

Any news on this?

1 vote

The FocusManager approach worked perfectly. Thank you.

  • Jamie Agate answered 2 months ago
  • last active 2 months ago
0 votes

Hi Suzanne,

Firstly, we recommend providing code to reproduce this error. You can share this with us in a codepen, or a codesandbox. Instructions on how to do this can be found here: https://www.scichart.com/blog/codepen-codesandbox-and-jsfiddle-support-in-scichart-js

Next, we also recommend trying that same code to reproduce against the latest version of SciChart: v3.3. The version you are using (v3.0) is not the latest and could have bugs or issues in it.

We will await your update with code to reproduce before providing further assistance.

Best regards,
Andrew

1 vote

Hi Jamie,

Thanks for your inquiry.
This is the default behavior of WPF TextBox, which is used under the hood of our TextAnnotation.

We would suggest you try forcing Focus to any other control before saving the data. This can be done using WPF capabilities, for instance, FocusManager:
https://learn.microsoft.com/en-us/dotnet/api/system.windows.input.focusmanager.setfocusedelement?view=windowsdesktop-8.0

Alternatively, you can override the TextAnnotation Template to update it on a keypress:
https://learn.microsoft.com/en-us/dotnet/desktop/wpf/data/how-to-control-when-the-textbox-text-updates-the-source?view=netframeworkdesktop-4.8

Please let us know if you are interested in this option. We can share the default Template.

Kind regards,
Lex S., MSEE
SciChart Technical Support Engineer

  • Lex answered 2 months ago
  • last active 2 months ago
1 vote

The background pattern in the Overview can be removed by how?

1 vote

Hi Jeong,

This can’t really be done like this. RenderableSeries are FrameworkElements and shouldn’t be declared in a ViewModel.

There are two ways to bind to RenderableSeries in SciChart WPF:

Method 1: declare RenderableSeries in XAML and bind to DataSeries in ViewModel

e.g.

<!-- where xmlns:s="http://schemas.abtsoftware.co.uk/scichart" -->
<s:SciChartSurface>

    <s:SciChartSurface.RenderableSeries>
        <s:FastLineRenderableSeries DataSeries="{Binding DataSeries}"
                                    StrokeThickness="1" StrokeDashArray="2 2"
                                    Stroke="OrangeRed"/>
    </s:SciChartSurface.RenderableSeries>

    <!--  XAxis, YAxis omitted for brevity  -->

</s:SciChartSurface>

// Viewmodel
class ViewModel 
{
    public XyDataSeries DataSeries { get; set; }
}

With this method your number of RenderableSeries are fixed but you can modify the data from a view model.

Method 2: Declare RenderableSeriesViewModels in XAML and bind to SciChartSurface.RenderableSeries with the SeriesBinding Markup extension

e.g.

<!-- Declare a SciChartSurface with SeriesBinding -->
<!-- Where xmlns:s="http://schemas.abtsoftware.co.uk/scichart -->
<s:SciChartSurface RenderableSeries="{s:SeriesBinding RenderableSeriesViewModels}">

   <!-- XAxis, YAxis omitted for brevity -->

</s:SciChartSurface>

private ObservableCollection<IRenderableSeriesViewModel> _renderSeriesViewModels;
public ObservableCollection<IRenderableSeriesViewModel> RenderableSeriesViewModels
{
   get { return _renderSeriesViewModels; }
   set
   {
      _renderSeriesViewModels = value;
         OnPropertyChanged("RenderableSeriesViewModels");
   }
}

With this method you have full control over adding, removing renderable series as well as modifying the data from the view model.

0 votes

The result screen is missing so I am uploading it.

1 vote

Hi Lex,
I follow the suggestion, set GrowBy to “0.0, 0.0”, and update my xaml code

<s:SciStockChart.XAxisStyle>
    <Style TargetType="s:CategoryDateTimeAxis">
        <Setter Property="FontSize" Value="{DynamicResource GlobalFontSize10}"/>
        <Setter Property="DrawLabels" Value="True" />
        <Setter Property="DrawMinorTicks" Value="False" />
        <Setter Property="DrawMajorTicks" Value="False" />
        <Setter Property="DrawMajorBands" Value="False" />
        <Setter Property="DrawMajorGridLines" Value="False" />
        <Setter Property="DrawMinorGridLines" Value="False" />
        <Setter Property="TextFormatting" Value="{Binding XAxisTextFormatting}" />
        <Setter Property="VisibleRange" Value="{Binding ParentViewModel.XRange, Mode=TwoWay}" />
        <Setter Property="VisibleRangeLimit" Value="{Binding ParentViewModel.XRangeLimit}"/>
        <Setter Property="AutoRange" Value="{Binding ParentViewModel.AutoRangeX}"/>
        <Setter Property="GrowBy" Value="0.0, 0.0"/>
    </Style>
</s:SciStockChart.XAxisStyle>

But the result is same, do I missing something?

1 vote

Hi Chia Chun Tang,

Thanks for your question.
SciStockChart is a preconfigured SciChartSurface version having some properties on its elements set to default values. Please take a look at the corresponding article for more info:
https://www.scichart.com/documentation/win/current/webframe.html#SciStockChart%20-%20Simplified%20Financial%20Charts.html

The spaces you see on the sides are controlled by the Axis.GrowBy property:
https://www.scichart.com/documentation/win/current/webframe.html#SciChart.Charting~SciChart.Charting.Visuals.Axes.AxisCore~GrowBy.html

To get rid of these spaces you can override the default value by setting the GrowBy property for the XAxis to “0.0, 0.0”.

With best regards,

Lex S., MSEE
SciChart Technical Support Engineer

  • Lex answered 2 months ago
Showing 41 - 60 of 6k results