Pre loader

Tag: AutoRange

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
20k views

I want YAxis Auto Scale less than the value max 10% and greater value min 10%, how?

  • kingsoff asked 11 years ago
  • last active 9 years ago
4 votes
25k views

How do I implement zooming in real time charts. The examples are all static data, and the zooming works, and a couple of links I found, do not explain it very well.

How can I accomplish zooming on a real time SciChart?

  • darlon asked 10 years ago
  • last active 6 years ago
1 vote
13k views

Hi,

After the chart is added with data I want to switch between using the ZoomExtents method and manually setting the AutoRange = Never and setting the VisibleRange. It works using either of them, but after using the ZoomExtents method the axis range is never adjusted to the VisibleRange. Am I doing something wrong or is not possible ?

Using SciChart 3.1.0

Best regards
Marius

1 vote
14k views

I found a post on here regarding this topic but the link to the solution was a dead link.

I want to Autorange without affecting my zoom abilities. If I set AutoRange=”Always”, then I can’t zoom. If I set AutoRange=”Once”, then it does it the first time but I have to double click every time after that. What is the solution to this issue (This is an issue!). Fixing this would not be adding a new feature, it would be removing a problem within the code.

Edit: I think a solution would be to fire an event on DataSeries Changed. Is there an event that corresponds to this? I searched through the dependency properties and couldn’t find anything like that.

Edit: I used the Rendered event and called scichart.ZoomExtents(). I thought this would work, but it doesn’t resize properly either.

Edit: I want to add that I understand the use case for real time data, but I am looking at a snapshot. I can choose different snap shots but they don’t change once chosen. I need to update the range on each choice but then allow me to zoom in between.

Edit: I think that the scichart is being zoomed before the new dataseries is set. I can’t prove it, but that is what my gut tells me.

  • Ryan Woods asked 8 years ago
  • last active 8 years ago
0 votes
3k views

If the y axis values are same then the lines are not visible on the chart and the labels are also not visible on the chart. Can you draw the lines on the middle of the chart to get more visible?

async initTrack() {
  const { wasmContext, sciChartSurface } = await SciChartSurface.create(
    "chart" + this.element
  );
  sciChartSurface.xAxes.add(
    new NumericAxis(wasmContext, { axisAlignment: EAxisAlignment.Top })
  );
  sciChartSurface.yAxes.add(
    new NumericAxis(wasmContext, {
      axisAlignment: EAxisAlignment.Left
    })
  );

  const dataSeries = new XyDataSeries(wasmContext);
  for (let i = 0; i <= 1000; i++) {
    dataSeries.append(i, 10);
  }

  const rendSeries = new FastLineRenderableSeries(wasmContext, {
    dataSeries: dataSeries,
    strokeThickness: 1,
    stroke: "red"
  });
  sciChartSurface.renderableSeries.add(rendSeries);
  sciChartSurface.chartModifiers.add(cursorModifier);

  return { wasmContext, sciChartSurface };
}
0 votes
7k views

pointMarker max and min values marker are cropped when autoRange is enabled. Check the attached image.

0 votes
5k views

Hi,
Unsorted xValues is possible on SCI Chart? I tried with dataIsSortedInX: false and isSorted: false on dataSeries, But its not showing the correct range.

eg:

 new XyDataSeries(wasmContext, {
        dataSeriesName: "Line Series",
        xValues: [0,10,20,13,54,15,26,17,18,19],
        yValues: [0,1,5,1,20,5,1,8,9,3],
    dataIsSortedInX: false
    });
0 votes
0 answers
7k views

Using iOS 11.2 and Xcode 9.2 and Swift 4

My chart includes two SCIXyDataSeries objects rendered by SCIFastLineRenderableSeries. Also I am using these chart modifiers: SCIPinchZoomModifier, SCILegendModifier, SCIZoomPanModifier

My Y axis is configured with autoRange set to always. Auto range works great as I pan left-and-right. However the Y axis does not “auto range” when I disable one of the data series by tapping on the legend. When I pan left-and-right I can see the auto-range adjusting the Y axis to fit the data set that is no longer visible. Any way to fix this?

Two screen shots are attached. The first shows both data sets visible. The second shows how the Y axis does not change when I de-select the yellow data series.

0 votes
7k views

Hi, guys

I want to show two renderableSeries on one chart view. These series have common x-axis (SCICategoryDateTimeAxis) and separate y-axes(SCINumericAxis). Only one of y-axis is visible at chart view. Also the data series of visible renderable series updated by scrolling to left or to right. So for displaying on one view i’m using:

[y1Axis setGrowBy: [[SCIDoubleRange alloc] initWithMin:SCIGeneric(0.3) Max:SCIGeneric(0.07)]];
[y2Axis setGrowBy: [[SCIDoubleRange alloc] initWithMin:SCIGeneric(0.0) Max:SCIGeneric(5)]];

So it’s look good at start (Correct_zooming.png). But after some scrolling it decrease axis extents of invisible y-axis (decrease.png).
Or even breaks down (broken.png)

For test i’m using SCIFastOhlcRenderableSeries and SCIHorizontallyStackedColumnsCollection readerable series.
Data series for SCIHorizontallyStackedColumnsCollection is initializated like:

    [volumeSerie1 updateAt:index Y:SCIGeneric(100000 / [multiplier doubleValue])];
    [volumeSerie2 updateAt:index Y:SCIGeneric(500000 / [multiplier doubleValue])];

So can you look at it?
Or what way i should implement this behavior?

Best regards,
Sushynski Andrei

0 votes
6k views

When setting yAxis to have auto range enabled or when manually calling chartSurface.zoomExtents() after adding new data to chart, the top point are cropped (not shown in the chart). I have attached an image that shows this phenomenon (note: bottom part of the chart is cropped out of the image).

Below is full code of an Activity that reproduces the problem. I also updated the attached image that shows the result of the following code. As you can see both red points with y value of 1.1f are cropped out of the chart.

class MainActivity : AppCompatActivity()
{
    private val chartBuilder by lazy { SciChartBuilder.instance() }
    private val chartSurface by lazy { createChartSurface() }

    override fun onCreate(savedInstanceState: Bundle?)
    {
        super.onCreate(savedInstanceState)

        SciChartBuilder.init(this)
        setContentView(R.layout.activity_main)

        val background = findViewById<ViewGroup>(R.id.background)
        background.addView(chartSurface)

        addPoints()
    }

    private fun createChartSurface(): SciChartSurface
    {
        val surface = SciChartSurface(this)

        val xAxis = chartBuilder.newNumericAxis()
            .withAxisTitle("X Axis title")
            .withVisibleRange(0.0, 1.0)
            .withAutoRangeMode(AutoRange.Always)
            .build()

        val yAxis = chartBuilder.newNumericAxis()
            .withAxisTitle("Y Axis title")
            .withVisibleRange(0.0, 1.0)
            .withAutoRangeMode(AutoRange.Always)
            .build()

        Collections.addAll(surface.xAxes, xAxis)
        Collections.addAll(surface.yAxes, yAxis)

        surface.renderableSeries.add(createSeries(Color.RED))
        surface.renderableSeries.add(createSeries(Color.BLUE))

        return surface
    }

    private fun createSeries(color: Int): FastLineRenderableSeries
    {
        val lineData = chartBuilder.newXyDataSeries(Long::class.javaObjectType, Float::class.javaObjectType)
            .withSeriesName("series")
            .build()

        return chartBuilder.newLineSeries()
            .withDataSeries(lineData)
            .withIsVisible(true)
            .withStrokeStyle(color, 2f, true)
            .build()
    }

    private fun addPoints()
    {
        val xValues = LongValues(longArrayOf(0, 1, 2, 3, 4, 5))

        @Suppress("UNCHECKED_CAST")
        var lineData = chartSurface.renderableSeries[0].dataSeries as XyDataSeries<Long, Float>
        lineData.append(xValues, FloatValues(floatArrayOf(0.9f, 1f, 1.1f, 0.9f, 1.1f, 1f)))

        @Suppress("UNCHECKED_CAST")
        lineData = chartSurface.renderableSeries[1].dataSeries as XyDataSeries<Long, Float>
        lineData.append(xValues, FloatValues(floatArrayOf(0f, 0f, 0f, 0f, 0f, 0f)))
    }
}
0 votes
10k views

When setting yAxis to have auto range enabled or when manually calling chartSurface.zoomExtents() after adding new data to chart, the top point are cropped (not shown in the chart). I have attached an image that shows this phenomenon (note: bottom part of the chart is cropped out of the image).

Below is full code of an Activity that reproduces the problem. I also updated the attached image that shows the result of the following code. As you can see both red points with y value of 1.1f are cropped out of the chart.

class MainActivity : AppCompatActivity()
{
    private val chartBuilder by lazy { SciChartBuilder.instance() }
    private val chartSurface by lazy { createChartSurface() }

    override fun onCreate(savedInstanceState: Bundle?)
    {
        super.onCreate(savedInstanceState)

        SciChartBuilder.init(this)
        setContentView(R.layout.activity_main)

        val background = findViewById<ViewGroup>(R.id.background)
        background.addView(chartSurface)

        addPoints()
    }

    private fun createChartSurface(): SciChartSurface
    {
        val surface = SciChartSurface(this)

        val xAxis = chartBuilder.newNumericAxis()
            .withAxisTitle("X Axis title")
            .withVisibleRange(0.0, 1.0)
            .withAutoRangeMode(AutoRange.Always)
            .build()

        val yAxis = chartBuilder.newNumericAxis()
            .withAxisTitle("Y Axis title")
            .withVisibleRange(0.0, 1.0)
            .withAutoRangeMode(AutoRange.Always)
            .build()

        Collections.addAll(surface.xAxes, xAxis)
        Collections.addAll(surface.yAxes, yAxis)

        surface.renderableSeries.add(createSeries(Color.RED))
        surface.renderableSeries.add(createSeries(Color.BLUE))

        return surface
    }

    private fun createSeries(color: Int): FastLineRenderableSeries
    {
        val lineData = chartBuilder.newXyDataSeries(Long::class.javaObjectType, Float::class.javaObjectType)
            .withSeriesName("series")
            .build()

        return chartBuilder.newLineSeries()
            .withDataSeries(lineData)
            .withIsVisible(true)
            .withStrokeStyle(color, 2f, true)
            .build()
    }

    private fun addPoints()
    {
        val xValues = LongValues(longArrayOf(0, 1, 2, 3, 4, 5))

        @Suppress("UNCHECKED_CAST")
        var lineData = chartSurface.renderableSeries[0].dataSeries as XyDataSeries<Long, Float>
        lineData.append(xValues, FloatValues(floatArrayOf(0.9f, 1f, 1.1f, 0.9f, 1.1f, 1f)))

        @Suppress("UNCHECKED_CAST")
        lineData = chartSurface.renderableSeries[1].dataSeries as XyDataSeries<Long, Float>
        lineData.append(xValues, FloatValues(floatArrayOf(0f, 0f, 0f, 0f, 0f, 0f)))
    }
}
1 vote
114 views

When using AutoRange.Once on an axis, I expect the auto ranging to be done exactly once.
If at some point, I change the visible range to match the default one (0 to 10 for numeric axis), the auto range is triggered again.

Happens more if I provide inputs so the user can define a range, and depending on the use case, 0 to 10 is not that uncommon.
Kind of an edge case, but still something that can happen, and is definitely unexpected.

This can be seen happening here https://codepen.io/jrfv/full/xxeqwOd

0 votes
9k views

Hello, I used example “Realtime Ticking Stock Charts” from yout SciChart application. It works fine.But when I load another data from other source then I have problem with AutoRange Y axis. The AutoRange feature does not work properly. See attachment, the left part of image shows zoomed chart, the right part unzoomed. You can see that on left image are cut under value 11834. The AutoRange is set to Always and data are ordered by time. Where could be the problem?

Thanks

  • Oto Dusek asked 6 years ago
  • last active 6 years ago
0 votes
6k 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 5 years ago
  • last active 5 years ago
1 vote
7k views

Hi, I asked a question a few days ago. I will try to explain better what I meant.
I get data in real time and I only care about the Y values.
My problem is that I don’t want to move forward on the X axis – but stay on a defined range
(If I move forward on the X-axis and I want to follow the graph I drew, I must define:

XAxis.AutoRange = SciChart.Charting.Visuals.Axes.AutoRange.Always;

And this means that I won’t be able to zoom properly unless I stop receiving the data, which is unacceptable.
So unless there is a way to set AutoRange = Always and still enable good zoom (similar to ZoomExtentsY for the X-axis), I need an option to keep seeing the graph all the time – without having to set AutoRange = Always so I can zoom.
I think the solution is to create a fixed range on the X-axis that the data will only be displayed on but before I implement it myself, I want to know if there is a better or built-in way to do this.

Just to make sure I’m understood, I want it to behave like in the attached images (the X-axis stays in the same range and the graph “move” to the left whenever new points enter from the right:

1 vote
2k views

Hi, I want to create an event that will run when the user checks a zoom square. (see picture: zoom_square.png)
My motivation:
I run realtime samples and set:

 AutoRange="Always"

It bothers me that I can’t zoom the X axis (because the AutoRange…) The way I found to solve it is to change the NumericAxis.GrowBy property. But I want it to happen automatically when the user checks a zoom square and not manually like it is now.

I added pictures:
1. A given situation in which the samples are seen. (AutoRange="Always")
2. What happens when you zoom (either with the zoom square or with the mouse wheel)- The Y axis is stretched but the X axis is not.
3. What does the graph look like if the user drags the X-axis to the sides and changes the NumericAxis.GrowBy ==> desired state.
I want step 3 to happen automatically according to the size of the square the user marked. (According to the size of the square, I will know how to define the appropriate NumericAxis.GrowBy)

thanks!

0 votes
9k views

Hi,

I’m working on the iOS and android version. I’m trying to implemented an animated visible range change on Y axis when zooming/panning X axis.

On iOS, I just have to do:
yAxis.autoRange = .always
yAxis.animateVisibleRangeChanges = true
yAxis.animatedChangeDuration = 0.5

But I can’t find a way to do that on Android, is it hidden somewhere else?

Kind Regards,
Alexis

1 vote
564 views

Hi,

I feel this should be obvious but I cannot find the answer in the docs. I have multiple Y axis and I want all of them to start at 0 and autoRange only the max value. Also, the zooming should not be affected, it should have normal behavior. I just want the axis to go from 0 to auto max value when we call ZoomExtents(). The default behavior of the ZoomExtents() is auto min value to auto max value.

Is there any way we can achieve this with SciChart?

Thank you,
Alex

0 votes
10k views

I am trying disable AutoRange=”Always” property for SciChartOverview. As for now I see only one way, change SciChartOverview template. But VS generate wrong template for SciChartOverview, chart line gone, after template replacement (I am using “Edit Template” -> “Edit Copy” feature from VS designer mouse context menu )

Here is template:

<s:SciChartOverview.Resources>
    <Style TargetType="{x:Type s:SciChartOverview}">
        <Setter Property="FontSize" Value="20"/>
        <Setter Property="FontWeight" Value="Normal"/>
        <Setter Property="Background" Value="{Binding (s:ThemeManager.Theme), Mode=OneWay, RelativeSource={RelativeSource Self}}"/>
        <Setter Property="Foreground" Value="{Binding (s:ThemeManager.Theme), Mode=OneWay, RelativeSource={RelativeSource Self}}"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="Fill" Value="{Binding (s:ThemeManager.Theme), Mode=OneWay, RelativeSource={RelativeSource Self}}"/>
        <Setter Property="Stroke" Value="{Binding (s:ThemeManager.Theme), Mode=OneWay, RelativeSource={RelativeSource Self}}"/>
        <Setter Property="SelectedRange" Value="{Binding Axis.VisibleRange, Mode=TwoWay, RelativeSource={RelativeSource Self}}"/>
        <Setter Property="RenderableSeriesStyle">
            <Setter.Value>
                <Style TargetType="{x:Type s:FastMountainRenderableSeries}">
                    <Setter Property="Fill" Value="{Binding Fill}"/>
                    <Setter Property="DataSeries" Value="{Binding DataSeries}"/>
                    <Setter Property="Stroke" Value="{Binding Stroke}"/>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="RenderableSeriesType" Value="{x:Type s:FastMountainRenderableSeries}"/>
        <Setter Property="ScrollbarStyle">
            <Setter.Value>
                <Style TargetType="{x:Type s:SciChartScrollbar}">
                    <Setter Property="Orientation" Value="Horizontal"/>
                    <Setter Property="GripsLength" Value="25"/>
                    <Setter Property="Background" Value="Transparent"/>
                    <Setter Property="ViewportStyle">
                        <Setter.Value>
                            <Style TargetType="{x:Type Control}">
                                <Setter Property="Opacity" Value="0"/>
                            </Style>
                        </Setter.Value>
                    </Setter>
                    <Setter Property="NonSelectedAreaStyle">
                        <Setter.Value>
                            <Style TargetType="{x:Type Path}">
                                <Setter Property="Fill" Value="{Binding (s:ThemeManager.Theme), Mode=OneWay, RelativeSource={RelativeSource Self}}"/>
                            </Style>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type s:SciChartOverview}">
                    <Grid x:Name="PART_Container">
                        <s:SciChartSurface x:Name="PART_BackgroundSurface" AnimateZoomExtentsCommand="" BorderThickness="0" Background="{TemplateBinding Background}" DebugWhyDoesntSciChartRender="False" Foreground="{TemplateBinding Foreground}" FontWeight="{TemplateBinding FontWeight}" FontSize="{TemplateBinding FontSize}" Padding="{TemplateBinding Padding}" RenderPriority="Normal" UseLayoutRounding="True" ZoomExtentsCommand="">
                            <s:SciChartSurface.ViewportManager>
                                <s:DefaultViewportManager>
                                    <s:DefaultViewportManager.Services>
                                        <Utility:ServiceContainer/>
                                    </s:DefaultViewportManager.Services>
                                </s:DefaultViewportManager>
                            </s:SciChartSurface.ViewportManager>
                            <s:SciChartSurface.YAxis>
                                <s:NumericAxis AutoRange="Always" DrawMajorGridLines="False" DrawMajorBands="False" DrawMinorGridLines="False" IsPrimaryAxis="True" TextFormatting="###E+0" UseLayoutRounding="True" Visibility="Collapsed">
                                    <s:NumericAxis.Services>
                                        <Utility:ServiceContainer/>
                                    </s:NumericAxis.Services>
                                    <s:NumericAxis.TickProvider>
                                        <s:NumericTickProvider/>
                                    </s:NumericAxis.TickProvider>
                                    <s:NumericAxis.TickCoordinatesProvider>
                                        <s:DefaultTickCoordinatesProvider/>
                                    </s:NumericAxis.TickCoordinatesProvider>
                                </s:NumericAxis>
                            </s:SciChartSurface.YAxis>
                            <s:SciChartSurface.YAxes>
                                <s:NumericAxis AutoRange="Always" DrawMajorGridLines="False" DrawMajorBands="False" DrawMinorGridLines="False" IsPrimaryAxis="True" TextFormatting="###E+0" UseLayoutRounding="True" Visibility="Collapsed">
                                    <s:NumericAxis.Services>
                                        <Utility:ServiceContainer/>
                                    </s:NumericAxis.Services>
                                    <s:NumericAxis.TickProvider>
                                        <s:NumericTickProvider/>
                                    </s:NumericAxis.TickProvider>
                                    <s:NumericAxis.TickCoordinatesProvider>
                                        <s:DefaultTickCoordinatesProvider/>
                                    </s:NumericAxis.TickCoordinatesProvider>
                                </s:NumericAxis>
                            </s:SciChartSurface.YAxes>
                        </s:SciChartSurface>
                        <s:SciChartScrollbar x:Name="PART_Scrollbar" Axis="{TemplateBinding Axis}" Height="{Binding ActualHeight, ElementName=PART_BackgroundSurface}" Style="{TemplateBinding ScrollbarStyle}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</s:SciChartOverview.Resources>

The main task for me, set fixed VisibleRange for YAxis.

0 votes
11k views

I’m trying to properly display a circle series as a circle. I’ve made sure the graph is not resizable, and set the GridLinesPanelStyle to ensure that it’s square. However, when do ZoomExtents on the ViewPortManager, it always adds a little buffer space on the Y axis but not the X so you end up with an ellipse. Is there any way to set and/or remove this buffer? You can see this in the image, the graph itself is square and the range on the X axis is 300, but on Y it’s a little bit bigger so what you see isn’t really a circle. Thank you.

  • AE Admin asked 7 years ago
  • last active 7 years ago
0 votes
6k views

Hi, i am developing a real time graph plotting application with various series on the chart. The application allows user to turn on and off the auto range using a radio button.

I am using the the viewport manager to adjust the y-axis visible range of each series. But i face an issue. The particular y axis visible range increase abnormally (keep increase indefinitely) when i uncheck the particular visibility checkbox on the legend. It back to normal when i check the visibility checkbox.

I do also provide the code of the ViewPort manager class in the zip file. Besides, i also prepare the video but fail to upload due to size limit.

Please provide me so guide how to solve this and why it happens. Looking forward on your reply. Thanks

  • mian ooi asked 3 years ago
  • last active 3 years ago
1 vote
2k views

Hello,

Normally, if I have a ScichartSurface with a X- and Y-Axis, were both axis AutoRange- properties are set to Always, the surface displays the entire data by adjusting the Visible ranges of the axis after new data has been appended.

This also works if there are multiple Data-Series on the ScichartSurface.

In my case, I have two FastLineRenderableSeries on my Surface. Each of them receiving new data via the Append-function while the x- and y-axis are continuously adjusted automatically to display all the datapoints of both Datasets.

So far so good…

But what would I have to do if I wanted one of the two Datasets to be ignored by the Autorange properties of the x- and y-Axis?

I have already tried to set the X- and YAxisID of one dataset to null, hoping I could make both axis ignore this Dataset while they are adjusting their Visible ranges. However, this only led to error messages.

I could also try to write my own ViewPortManagers and overwrite the OnCalculateNewXRange and OnCalculateNewYRange funvtions, but that seems a little bit excessive.

Is there an easy way to achieve the desired behavior?

Thanks.

Showing 22 results

Try SciChart Today

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

Start TrialCase Studies