1 回答

TA貢獻(xiàn)1909條經(jīng)驗(yàn) 獲得超7個(gè)贊
除非您的鼠標(biāo)具有驚人的準(zhǔn)確性,否則您永遠(yuǎn)不會看到精確的 10.000。你可以四舍五入:
private void Chart1_MouseClick(object sender, MouseEventArgs e) {
double yValue = chart1.ChartAreas[0].AxisY.PixelPositionToValue(e.Y);
yValue = Math.Round(yValue, 0);
}
或者您希望在光標(biāo)點(diǎn)擊位置附近找到數(shù)據(jù)點(diǎn)?
private void Chart1_MouseClick(object sender, MouseEventArgs e) {
HitTestResult result = chart1.HitTest(e.X, e.Y);
if (result.ChartElementType == ChartElementType.DataPoint) {
DataPoint point = (DataPoint)result.Object;
double yValue = point.YValues[0];
}
}
- 1 回答
- 0 關(guān)注
- 402 瀏覽
添加回答
舉報(bào)