TeeChart 趋势图提示框

本文介绍了一种在Steema TeeChart中实现鼠标悬停时显示图表点值的方法。通过创建FastLine和Points系列,并利用MarksTip工具来实现点值提示效果。文章提供了具体的代码示例,展示了如何设置数据源、样式及提示行为。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

说明:

  将鼠标移动到POINT上时,显示该点的值。

  其实就是在一条FASTLINE上再画一组点,二者重叠。

 

  private Steema.TeeChart.Styles.FastLine area1, area2;
        private Steema.TeeChart.Styles.Points points1, points2;
        private Steema.TeeChart.Tools.MarksTip tooltip1, tooltip2;


        private void Form1_Load(object sender, EventArgs e)
        {
            area1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
            points1 = new Steema.TeeChart.Styles.Points(tChart1.Chart);
            area2 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
            points2 = new Steema.TeeChart.Styles.Points(tChart1.Chart);
            tooltip1 = new Steema.TeeChart.Tools.MarksTip(tChart1.Chart);
            tooltip2 = new Steema.TeeChart.Tools.MarksTip(tChart1.Chart);
            //--------------------------------------------------------//
            tChart1.Aspect.View3D = false;
            area1.Add(1, 10);
            area1.Add(2, 15);
            area1.Add(3, 20);
            area1.Add(4, 25);
            area1.Add(5, 30);
            area2.FillSampleValues();
            points1.DataSource = area1;
            points2.DataSource = area2;
            points1.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Diamond;
            points2.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Diamond;
            tooltip1.Series = points1;
            points1.Color = area1.Color;
            points1.Pointer.Pen.Color = area1.LinePen.Color;
            tooltip2.Series = points2;
            //---------------------------------------------------------------//
            points2.Color = area2.Color;
            points2.Pointer.Pen.Color = area2.LinePen.Color;
            tooltip1.MouseDelay = 50;
            tooltip1.MouseAction = Steema.TeeChart.Tools.MarksTipMouseAction.Move;
            tooltip1.Style = Steema.TeeChart.Styles.MarksStyles.XY;
            tooltip2.MouseAction = Steema.TeeChart.Tools.MarksTipMouseAction.Move;
            tooltip2.Style = Steema.TeeChart.Styles.MarksStyles.Value;
            //-------------Style Legend-----------------------------------------//
            points1.ShowInLegend = false;
            points2.ShowInLegend = false;
            tChart1.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Values;
            //-------------------------------------------------------------------//

        }

 

转载于:https://www.cnblogs.com/as311011/archive/2010/03/03/1677301.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值