这个图鼠标可以选柱子啊~ 只是没有写代码修改选中柱子的颜色,所以你看起来好像没有选一样。
同样的道理,挂MouseMove事件,在事件获取选中的数据,然后展示就可以了。代码如下:- int old_row = -1, old_col = -1;
- private void c1Chart3D1_MouseMove(object sender, MouseEventArgs e)
- {
- float _x = 0, _y = 0, _z = 0;
- if (this.c1Chart3D1.ChartGroups[0].ChartData.CoordToDataCoord(e.X, e.Y, ref _x, ref _y, ref _z))
- {
- this.c1Chart3D1.ChartLabels[0].Text = String.Format("X={0}; Y={1}; Z={2}", _x, _y, _z);
- this.c1Chart3D1.ChartLabels[0].Visible = true;
- }
- int row = 0, col = 0;
- if (c1Chart3D1.ChartGroups[0].ChartData.CoordToDataIndex(e.X, e.Y, ref col, ref row))
- {
- c1Chart3D1.ChartLabels[0].AttachMethodData.Column = col;
- c1Chart3D1.ChartLabels[0].AttachMethodData.Row = row;
- old_row = row;
- old_col = col;
- }
- }
复制代码 |