multi sync to ConstantLine

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

Lawrence_Jung
Posts: 14
Joined: Mon Jul 03, 2017 8:43 am

multi sync to ConstantLine

Post by Lawrence_Jung » Thu Oct 26, 2017 1:35 am

hello, dear

Lightning chart is vary useful for me. so thanks

And I have one question. I have many point line series and area series. Series have each Y axis.

but I want to all Yaxis value of just One Constant line.

Is it possible??

if that possible then send to some example or reply please.

thanks.
Attachments
capture.jpg
capture.jpg (124.92 KiB) Viewed 5333 times

ArctionKestutis
Posts: 383
Joined: Mon Mar 14, 2016 9:22 am

Re: multi sync to ConstantLine

Post by ArctionKestutis » Thu Oct 26, 2017 9:14 am

Hello Jung,

Could you clarify your question a little bit?
If you want to assign single ConstantLine to all y axes, it is not possible?!
Are your drawing ConstantLine at same value for each y-axes, but want them be on same vertical location (on the screen)?
Please clarify.

All the best.

Lawrence_Jung
Posts: 14
Joined: Mon Jul 03, 2017 8:43 am

Re: multi sync to ConstantLine

Post by Lawrence_Jung » Fri Oct 27, 2017 12:40 am

my chart drawing ConstantLine at different value for each Yaxis, but screen position is same.

because user want to individual scaling at Y axis.

so it is not possible. Do you have not any solution?? I will must do it. please...

ArctionKestutis
Posts: 383
Joined: Mon Mar 14, 2016 9:22 am

Re: multi sync to ConstantLine

Post by ArctionKestutis » Fri Oct 27, 2017 8:11 am

Hello Jung,

Your task could be formulated as following: pan all available Axes for constant line to overlap, right?

The simplest workflow is to read ConstantLine.Value, estimate NEW Minimum & Maximum of Yaxis (while keeping Y range the same) and set new Range.
For example,

Code: Select all

        private void UpdateYaxesRange()
        {
            int axesCount = _chart.ViewXY.ConstantLines.Count;

            _chart.BeginUpdate();

            for (int i = 0; i < axesCount; i++)
            {
                ConstantLine cls = _chart.ViewXY.ConstantLines[i];
                AxisY yAxis = _chart.ViewXY.YAxes[cls.AssignYAxisIndex];

                double newMax = cls.Value + (yAxis.Maximum - yAxis.Minimum) * 0.5;
                double newMin = cls.Value - (yAxis.Maximum - yAxis.Minimum) * 0.5;
                yAxis.SetRange(newMin, newMax);
            }

            _chart.EndUpdate();
        }
The code above places ConstantLine in the middle of GraphicArea. Therefore, you see multiplier 0.5. You can have ConstantLine at any location by simple changing this multiplier (just it should sum of 1 for NewMax and NewMin).

Hope this helps.
All the best.

Lawrence_Jung
Posts: 14
Joined: Mon Jul 03, 2017 8:43 am

Re: multi sync to ConstantLine

Post by Lawrence_Jung » Tue Oct 31, 2017 1:56 am

hello, dear

thanks for reply

but my chart use to different Yaxis range

so, i looking for differ solution.

Because i will must do it. If you find the other solution, talk to me, please

Best Regards.

ArctionKestutis
Posts: 383
Joined: Mon Mar 14, 2016 9:22 am

Re: multi sync to ConstantLine

Post by ArctionKestutis » Tue Oct 31, 2017 12:17 pm

Hello,
If you want to zoom as well, when you should add/subtract same amount to Axis' Maximum/Minimum. If you maintain symmetry, the ConstantLine will at the same screen coordinate.