GetValueByYWpf()

View as Markdown

Definition

Returns the series value on the chart scale determined by a WPF coordinate on the chart.

Method Return Value

A double value representing a series value on the chart scale. This is normally a price value, but can represent indicator plot values as well.

Syntax

\<chartscale\>.GetValueByYWpf(double y)

Method Parameters

ParameterDescription
yA double value representing a WPF coordinate on the chart scale

Examples

1protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
2{
3 // store the y location the user clicked
4 double wpfY = chartControl.MouseDownPoint.Y;
5
6 // gets price value of the WPF coordinate passed to the method
7 double valueByYWpf = chartScale.GetValueByYWpf(wpfY);
8
9 Print("valueByYWpf: " + valueByYWpf); //2105.49995215
10}

In the image below, we used the Chart Control property MouseDownPoint as the “wpfy” variable, which in return tells us the user clicked on a Y value of 2105.499 on the chart scale.

getvaluebyywpf