How to make a static grid with scrolling data (Winforms) ?

Need help in implementing some specific function to your LightningChart Ultimate powered application? Post a question and get code snippets from other LightningChart Ultimate community members.

Moderator: Arction_LasseP

Posts: 1
Joined: Thu Mar 22, 2018 5:21 pm

How to make a static grid with scrolling data (Winforms) ?

Post by CraigF » Thu Mar 22, 2018 5:34 pm

I wish to hide both the x and y axis and all borders, and I want a fixed xy grid visible behind my scrolling line traces, with ten divisions in the Y direction and four divisions in the x direction. I can get everything working except the grid.

The manual says:
you should use static X grid. Hide the regular X axis objects by setting LabelsVisible = false,
MajorGrid.Visible = false and MinorGrid.Visible = false. Then, show the static X grid by setting
MajorStaticXGridOptions and MinorStaticXGridOptions.
However, I cannot find any property corresponding to MajorStaticXGridOptions or MinorStaticXGridOptions. Can anybody help, or post a link to an example that uses a fixed grid?

Edit: What I have done as a workaround is to add another X-axis that does not scroll (and has no data associated with it). I put the vertical gridlines on that axis and hid them on the original X-axis. This seems to work OK. I assume the horizontal gridlines are still scrolling, but I can't see it moving, so it's merely wasteful. However, I remain confused about the concept of the Static Grid as referenced in the user manual.

The user manual merely hints at many details -- is there a more complete set of documentation somewhere? Or perhaps a source of examples other than the demo programs?


Posts: 401
Joined: Mon Mar 14, 2016 9:22 am

Re: How to make a static grid with scrolling data (Winforms)

Post by ArctionKestutis » Mon Mar 26, 2018 9:33 am


Sorry for the delayed response. Sometimes question in the forum get lost. You should be able to get faster reply, if you will write directly to Arction's support address ;) :oops:
Thank for the reading User's Manual and reporting error. Indeed this part of manual and relevant example have not been modified for many years.
Nothing is wrong with using secondary axis - is is good alternative. The intended usage of Triggering is in "Oscilloscope" example, our Demo App -> XY -> Real-time monitoring.

- To hide axis and border, you just need to disable automatic axis layout and set margins to zero:

Code: Select all

            //Disable automatic axis layouts 
            _chart.ViewXY.AxisLayout.AutoAdjustMargins = false;
            _chart.ViewXY.AxisLayout.XAxisAutoPlacement = XAxisAutoPlacement.Off;
            _chart.ViewXY.AxisLayout.YAxisAutoPlacement = YAxisAutoPlacement.Off;
            _chart.ViewXY.AxisLayout.XAxisTitleAutoPlacement = false;
            _chart.ViewXY.AxisLayout.YAxisTitleAutoPlacement = false;

            //Set margins
            _chart.ViewXY.Margins = new Padding(0, 0, 0, 0);
- Properties you mentioned are now renamed and probably moved. You need to set AxisX scroll mode to Triggering, disable visibility and enable Triggering.TriggeringActive, e.g.:

Code: Select all

            AxisX axisX = _chart.ViewXY.XAxes[0];
            axisX.Maximum = 0.01;
            axisX.ScrollMode = XAxisScrollMode.Triggering;
            axisX.Visible = false;

            // Configure x-axis. triggering
            axisX.Triggering.StaticMajorXGridOptions.Visible = true;
            axisX.Triggering.StaticMinorXGridOptions.Visible = true;
            axisX.Triggering.StaticMinorXGridOptions.DivCount = 5;
            axisX.Triggering.TriggerSeriesType = TriggeringSeriesType.SampleDataSeries;
            axisX.Triggering.TriggerLineSeriesIndex = 0;
            axisX.Triggering.TriggeringActive = true;
            axisX.Triggering.TriggerLevel = cls.Value;
            axisX.Triggering.TriggeringPositionChanged += new Triggering.TrigPositionChangedHandler(TrigViewOptions_OnTrigPosChanged);
Indeed User's Manual is only brief document. However, most of user fail to read even that - thank you again for reading. You can get a lot of relevant details by contacting us. As stated in the preamble of a document, don’t hesitate to contact support ( if you have any question!

All the best.