Skip to content

Dynamically updating the range every 10 seconds #1133

Description

@muenchris

I am trying to replace Smoothie Charts with uPlot. WIth Smoothie I can update the Min/Max (range) of the Y series at any time and the plot redraws accordingly and automatically.

How can I do this with uPlot?

I tried setScale but that did not work.
I tried a dynamic range in the Options but that is only called when the options are applied at Chart create.
I tried updating this.uPlotOptions.scales.y.range[1]=newRange
and this.myChartControl.scales.y.range[1]=newRange

The plot still is not changing its range at runtime.

Is there a example that show how to dynamically change the (Y scale) range?

my options are very simple:

        uPlotOptions:uPlot.Options = {
            width: 100,
            height: 100,
            pxAlign: true,
            axes: [{ show: false }, { show: false }], // Clean look
            series: [
                {} //New series are added at runtime
            ],
            legend: {
                show: false
            },
            cursor: {
                show: false,
            },
            scales: {
                x: { time: false, dir: -1 }, // -1 = left to right
                y: {
                    // auto: false, range: (u, min, max) => {
                    //     return [this.rangeMin, this.rangeMax];
                    // }
                } // Full height
            }
        };

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions