Hello,
I have some problems when I get Y values.
My chart has few Y axes but only have 1 ConstantLine in there.
When we are creating ConstantLine, it needs to be set the owner Y axis.
Therefore it can be read only its' axis value.
I want to get every axis values using 1 ConstantLine. I don't want to make many ConstantLine for reading Y value.
Is it possible?
How can I get Y values using single ConstantLine
Moderator: Queue Moderators
-
- Posts: 557
- Joined: Mon Mar 14, 2016 9:22 am
Re: How can I get Y values using single ConstantLine
Hello,
You will loose precision, but you can use converters. That is, in event handler you could use screen coordinates to/from axis values converters (Axis.ValueToCoord and Axis.CoordToValue) to estimate the position of ConstantLine. For example,
Hope this helps.
You will loose precision, but you can use converters. That is, in event handler you could use screen coordinates to/from axis values converters (Axis.ValueToCoord and Axis.CoordToValue) to estimate the position of ConstantLine. For example,
Code: Select all
ConstantLine constantLine = chart.ViewXY.ConstantLines[0];
// get screen coordinates [px] for Line value
float yCoord = chart.ViewXY.YAxes[0].ValueToCoord(constantLine.Value, false);
for (int iY = 0; iY < chart.ViewXY.YAxes.Count; iY++)
{
AxisY axisY = chart.ViewXY.YAxes[iY];
// estimate Axis value for corresponding screen coordinate
double yValue;
axisY.CoordToValue(yCoord, out yValue, false);
System.Diagnostics.Debug.WriteLine(string.Format("Yaxis #[{0}], Line at [{1}]", iY, yValue));
}
Re: How can I get Y values using single ConstantLine
Can you regain the precision that you lost by using converters after the fact somehow?Junseob wrote: ↑Thu Nov 15, 2018 3:03 pm Hello,
I will always recommend probiotics for women and have some problems when I get Y values.
My chart has few Y axes but only have 1 ConstantLine in there.
When we are creating ConstantLine, it needs to be set the owner Y axis.
Therefore it can be read only its' axis value.
I want to get every axis values using 1 ConstantLine. I don't want to make many ConstantLine for reading Y value.
Is it possible?