在没有可见标记的Devexpress折线图中获取点击的点

时间:2014-07-23 11:33:58

标签: winforms devexpress linechart

我正试图在winforms的deveexpress 1.14折线图上点击点。它可以正常工作,LineSeriesView MarkerVisibility设置为true,但我不希望这些点被标记为,我想要一个smoth行。如何在不这样做的情况下获得Seriespoint?

private void chart_MouseClick(object sender, MouseEventArgs e) {
  // Obtain the object being clicked.
    ChartHitInfo hi = chart.CalcHitInfo(e.X, e.Y);
    // Check whether it was a series point, and if yes - 
    // obtain its argument, and pass it to the detail series.
    SeriesPoint point = hi.SeriesPoint; // hi.SeriesPoint IS NULL

    if (point != null) {
       // do stuff

    }
}

该图表的runtimeHitTesting已启用 谢谢!

1 个答案:

答案 0 :(得分:1)

遭入侵:

void chart_CustomDrawSeries(object sender, CustomDrawSeriesEventArgs e)
    {
        LineDrawOptions drawOptions = e.SeriesDrawOptions as LineDrawOptions;
        if (drawOptions == null)
            return;
        drawOptions.Marker.Color = Color.Transparent;
        drawOptions.Marker.BorderColor = Color.Transparent;
    }

记得设置`this.chart.CacheToMemory = true;所以事件不会一直开火。