【问题标题】:Get clicked point in Devexpress line chart without visible markers在没有可见标记的情况下获取 Devexpress 折线图中的点击点
【发布时间】:2014-07-23 11:33:58
【问题描述】:

我正在尝试在 winforms 中的 deveexpress 1.14 折线图上获得点击点。将 LineSeriesView MarkerVisibility 设置为 true 时效果很好,但我不希望像那样标记点,我想要一条平滑的线。如果不这样做,我如何获得 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 已开启 谢谢!

【问题讨论】:

    标签: winforms devexpress linechart


    【解决方案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;所以事件不会一直触发。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-09-24
      • 1970-01-01
      • 2013-04-04
      • 1970-01-01
      • 2016-07-24
      • 2017-11-16
      • 2013-11-25
      相关资源
      最近更新 更多