Page 1 of 1
multi sync to ConstantLine
Posted: Thu Oct 26, 2017 1:35 am
by Lawrence_Jung
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.
Re: multi sync to ConstantLine
Posted: Thu Oct 26, 2017 9:14 am
by ArctionKestutis
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.
Re: multi sync to ConstantLine
Posted: Fri Oct 27, 2017 12:40 am
by Lawrence_Jung
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...
Re: multi sync to ConstantLine
Posted: Fri Oct 27, 2017 8:11 am
by ArctionKestutis
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.
Re: multi sync to ConstantLine
Posted: Tue Oct 31, 2017 1:56 am
by Lawrence_Jung
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.
Re: multi sync to ConstantLine
Posted: Tue Oct 31, 2017 12:17 pm
by ArctionKestutis
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.