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

1 vote

The FocusManager approach worked perfectly. Thank you.

  • Jamie Agate answered 1 month ago
  • last active 1 month ago
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 1 month ago
  • last active 1 month 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
0 votes

This task is now done and released as of version 3.2.575. SciChartVerticalGroup will now copy LayoutStrategies from the existing LayoutManager onto it’s SynchronisedLayoutManager so custom synchronised layouts will just work.

Regards
David

0 votes

Is your question related to WPF (Windows charts) or JS (JavaScript charts)?

In SciChart.js there is a mechanism to get a callback on legend checkbox changed. See the LegendModifier documentation.

Subscribing to Checkbox Checked Changed

As well as subscribing to BaseRenderableSeries.isVisibleChanged, you
can now subscribe to LegendModifier.isCheckedChanged event. This can
be done either in the constructor options to LegendModifier or after
creation.

const legend = new LegendModifier({
      showCheckboxes: true,
      showSeriesMarkers: true,
      showLegend: true,
      // Subscribe to checked changed here
      isCheckedChangedCallback: (series, isChecked) => {
          console.log(`Option 1: Legend item ${series.type} isChecked=${isChecked}`);   
      }
  });
  // Or here after instantiation
  legend.isCheckedChanged.subscribe((args) => {
      console.log(`Option 2: Legend item ${args.series.type} isChecked=${args.isChecked}`);
  });
  // Add the legend to the chart
  sciChartSurface.chartModifiers.add(legend);
  
1 vote

Hi there,

Please find attached an example that demonstrates how to use SciChart API to achieve the desired behavior.

The example utilizes PointMetadata API to add Selectable and Hoverable state to data points and Palette Provider API to change Fill color of individual columns depending of the state of the underlying data point. Also, a simple custom Chart Modifier is used to implement state changing behavior on Mouse events and trigger a chart redraw when such change occurs.

Please let me know if you have any questions regarding the example or any SciChart APIs that are used.

Best Regards,
Joeri, BS Inf
SciChart Software Engineer

0 votes

Hi Yu Dexiu,

Thanks for your question.
There isn’t such a callback on the LegendModifier.

However, since Legend checkboxes can hide or show a RenderableSeries, you can subscribe to IsVisibleChanged event on a RenderableSeries. It will be fired when a user changes series visibility through the Legend.

Alternatively, you can re-template the default Legend and have a binding on Checkboxes that will be triggered when they are checked/unchecked.

You can find more info about Legend customization here:
https://www.scichart.com/documentation/win/current/webframe.html#LegendModifier.html

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

  • Lex answered 2 months ago
0 votes

For server side licensing, the underlying component is in C++ and can be integrated into other languages and run on linux. We are currently working on improving the api and examples for this. Detailed questions on this need to be submitted on support.scichart.com as there are additional contractual requirements.
Regards
David

0 votes

Thank you for getting in touch. The first thing we tend to ask for is steps or code to reproduce issues.

For SciChart.js (JavaScript) this can be created as a Codepen or CodeSandbox (here’s how).

This makes it really easy to share with the tech team & resolve problems fast.

Thanks for your understanding! We look forward to hearing back from you.

0 votes

Hello Max, we are investigating the error on our side and here are some updates on the issue.
The error occurs specifically with Next 14.1, and seems to be related to module resolution during compilation. Specifically while compiling CommonJS modules. (BTW, running the boilerplate app in dev mode with “–turbo” seems to work fine)

Unfortunately, SciChart sources are built in CommonJS, and the library doesn’t support ES Modules, at the moment. (v3.3.570)

But the recently released library version provides a bundle with ESM support – “scichart/_wasm/scichart.browser.mjs”.

So as a temporary workaround you could use it like this:

import { SciChartSurface, NumericAxis } from "scichart/_wasm/scichart.browser.mjs";

To enable type checking you may add

import * as SciChartValue from "scichart/_wasm/scichart.browser.mjs";
import * as SciChartType from "scichart";
const SciChart = SciChartValue as typeof SciChartType;
const { SciChartSurface, NumericAxis } = SciChart;

We will be posting updates here. And, let us know if that works on your side.

1 vote
In reply to: axis tick label "-0"

I am considering applying server-side licensing for my javerScript application.

In the document below, there is a phrase “Our server-side licensing component is written in C++.”
(https://support.scichart.com/index.php?/Knowledgebase/Article/View/17256/42/)

However, there is only asp.net sample code on the provided github.
(https://github.com/ABTSoftware/SciChart.JS.Examples/tree/master/Sandbox/demo-dotnet-server-licensing)

I wonder if there is a sample code implemented in C++ for server-side licensing.

Can you provide c++ sample code?
Also, are there any examples to run on Ubuntu?

  • Lex answered 2 months ago
1 vote
0 votes
In reply to: Absolute Zoom in/out

Hi Ziv,

We discussed your inquiry.
Unfortunately, SciChart doesn’t provide this behavior out of the box.

However, it can be implemented on the user side by overriding the PerformScale(Point currentPoint, Point lastPoint, bool isSecondHalf) method of the YAxisDragModifier.
This method is called on every MouseMove event and calculates a new VisibleRange for an Axis based on the dragged distance. Please take a look:
https://www.scichart.com/documentation/win/current/webframe.html#SciChart.Charting~SciChart.Charting.ChartModifiers.AxisDragModifierBase~PerformScale.html

The default implementation is straightforward:

        protected virtual void PerformScale(Point currentPoint, Point lastPoint, bool isSecondHalf)
    {
        var axis = CurrentAxis;
        var scaledRange = CalculateScaledRange(currentPoint, lastPoint, isSecondHalf, axis);
        axis.VisibleRange = scaledRange;
    }

so you should just calculate the VisibleRange according to your desired behavior and assign it to the axis.VisibleRange instead of the scaledRange.

Hope this helps.

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

  • Lex answered 2 months ago
0 votes

Hello, I have the same problem, I see that Maksim described it in great detail,
I’m using the latest version of SciChart (v8.3.0.28019), TargetFramework net7.0-windows.
Could you please take a look at this issue.

0 votes
In reply to: Axis range

Hi Andrew,

Thank you for your answer!

In our case, we do not want to clip the visible range. What I am trying to achieve is the following: I have a series with some number of data points. Let us assume that in this series the lowest value is 67 and the highest value is 71. If we plot this normally with autorange = once, it will auto-range the Y axis to the visible range (67, 71). What I would like is to use the autorange feature so it automatically calculates the maximum range of Y axis but I would like to minimum range for Y axis to be 0 not 67 when we use ZoomExtentsModifier. The rest of the behaviors I do not want to affect: zooming, panning, dragging. What I am trying to say is that when I play with the zoom I do not want to restrict it. For example, if I play with the zoom I would like the range to modify to let’s say (68, 70) but also (-20, 100) (no clipping). But when we double-click the chart to trigger the ZoomExtentsModifier I would like to visible range to go to (0, 71) instead of (67, 71).

I am in an MVVM environment.
As I said in my comment I got it working the way I want by taking advantage of the GrowBy property. What I did was:

DoubleRange dr = axis.GetMaximumRange().AsDoubleRange();
axis.GrowBy = new DoubleRange(dr.Min / dr.Diff, dr.Max * 0.1 / dr.Diff);

This ensures that we have a 0 value as the min value of the visible range and we have a padding of 10% on the maximum side when we trigger the ZoomExtentsModifier. When I did this, I was not in an MVVM environment and I was using the NumericAxis type.

Since then, I moved to an MVVM environment and I am now using the NumericAxisViewModel type instead. But now, with this type do not have access to the GetMaximumRange() function. I need this function because in my example above it would return the visible range computed by the auto range which would be (67, 71).

Is this something we could achieve?

0 votes
In reply to: Annotations in MVVM

Hello Nicolas,

As for your question, I’ve investigated it and here are some results:
[1] First of all, MeasureXYAnnotation is the custom Annotation that is not part of SciChart library. The purpose of this in our official SciChart.Examples.Demo is to demonstrate the possibility and flexability of creating custom types of annotations based on our existing ones.
This Annotation was made without supporting MvvM, as it wasn’t a requirement for the exact example.

[2] You can try to implement your custom annotation ViewModel and add the Update() logic there
– You can start with this documentation:
https://www.scichart.com/documentation/win/current/webframe.html#Tutorial%2007b%20-%20Adding%20Annotations%20with%20MVVM.html
*** Note that your annotation(real one not viewModel) should be derived from CompositeAnnotationForMvvm not just CompositeAnnotation(to save all the style bindings for all properties)

public partial class MeasureXyAnnotation : CompositeAnnotationForMvvm

  • The next thing will be to store somehow an object of real one annotation(you can use different ways to achieve this by using Interfaces etc)
  • Then you’ll have to create a method that will call Update()method functionality on ‘a real’ annotation that is stored inside it. Simple method that will get two doubles as a parameters and set’s it accordingly to the X2Y2 props

***** Also you might need to use the AnnotationCreationModifierViewModel
For general idea you can take a look at our TradingAnnotations implementation.

If you still have questions regarding implementation, please ask.

Showing 41 - 60 of 6k results