VC TeeChart 鼠标点击曲线如何显示曲线上点的坐标?

一朵格桑花 2014-03-21 09:15:52
我用的是TeeChart8 档鼠标点击曲线的时候我想把这个点的坐标显示出来 怎么实现?
...全文
277 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
一朵格桑花 2014-03-24
  • 打赏
  • 举报
回复
引用 2 楼 xuddk727 的回复:
另外,当鼠标指针指向曲线时得显示当前的数据值,很简单,只需要添加一个消息响应函数,OnMouseEnterSeries即可 void CChartADODlg::OnOnMouseEnterSeriesTchart1(long SeriesIndex) { // TODO: Add your control notification handler code here if (SeriesIndex==0) { CString cs; cs.Format("x:%f y:%f",dataX,dataY); SetDlgItemText(IDC_STATIC_Y,cs); } } http://www.cnblogs.com/hyd10000/archive/2010/09/08/1821584.html
我添加的消息响应 怎么这个函数没调用 这么写有问题吗? ON_EVENT(CDrawTuBiao1, IDC_TEE_CHART, 21, OnMouseEnterSeries, VTS_I2 VTS_I2 VTS_I2)
许文君 2014-03-21
  • 打赏
  • 举报
回复
另外,当鼠标指针指向曲线时得显示当前的数据值,很简单,只需要添加一个消息响应函数,OnMouseEnterSeries即可 void CChartADODlg::OnOnMouseEnterSeriesTchart1(long SeriesIndex) { // TODO: Add your control notification handler code here if (SeriesIndex==0) { CString cs; cs.Format("x:%f y:%f",dataX,dataY); SetDlgItemText(IDC_STATIC_Y,cs); } } http://www.cnblogs.com/hyd10000/archive/2010/09/08/1821584.html
许文君 2014-03-21
  • 打赏
  • 举报
回复
http://www.cnblogs.com/hyd10000/archive/2010/09/08/1821584.html

void CChartADODlg::OnOnMouseMoveTchart1(long Shift, long X, long Y)
{
    // TODO: Add your control notification handler code here
    m_chart.Repaint();
    long x1,y1,x2,y2;
    x1 = m_chart.GetAxis().GetLeft().GetPosition();
    y1 = m_chart.GetAxis().GetTop().GetPosition();
    x2 = m_chart.GetAxis().GetRight().GetPosition();
    y2 = m_chart.GetAxis().GetBottom().GetPosition();
    if (X>=x1&&Y>=y1&&X<=x2&&Y<=y2)
    {

        m_chart.GetCanvas().DrawLine(x1,Y,x2,Y);
        m_chart.GetCanvas().DrawLine(X,y1,X,y2);
    }

    DOUBLE posX,posY;
    posX = m_chart.GetAxis().GetBottom().CalcPosPoint(X)+1;
    posY = m_chart.GetAxis().GetLeft().CalcPosPoint(Y);
    dataX = posX;
    dataY = posY;
    CString cs;
    cs.Format("posX:%f posY:%f\r\n",posX,posY);
    TRACE(cs);
    SetDlgItemText(IDC_STATIC_X,cs);
}

 

3,245

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧