zoukankan      html  css  js  c++  java
  • Drawing line on a click on ZedGraph Pane

    https://stackoverflow.com/questions/12422398/drawing-line-on-a-click-on-zedgraph-pane

    public Form1()
        {
            InitializeComponent();
        }        
    
        PointPairList userClickrList = new PointPairList();
        LineItem userClickCurve = new LineItem("userClickCurve");
    
        private void zedGraphControl1_MouseClick(object sender, MouseEventArgs e)
        {
            // Create an instance of Graph Pane
            GraphPane myPane = zedGraphControl1.GraphPane;
    
            // x & y variables to store the axis values
            double xVal;
            double yVal;
    
            // Clear the previous values if any
            userClickrList.Clear();
    
            myPane.Legend.IsVisible = false;
    
            // Use the current mouse locations to get the corresponding 
            // X & Y CO-Ordinates
            myPane.ReverseTransform(e.Location, out xVal, out yVal);
    
            // Create a list using the above x & y values
            userClickrList.Add(xVal, myPane.YAxis.Scale.Max);
            userClickrList.Add(xVal, myPane.YAxis.Scale.Min);
    
            // Add a curve
            userClickCurve = myPane.AddCurve(" ", userClickrList, Color.Red, SymbolType.None);
    
            zedGraphControl1.Refresh();
        }
    

    enter image description here

    you just have to change the userClickList to draw horizontal line.

  • 相关阅读:
    numpy通用函数
    机器学习之随机森林
    机器学习之支持向量机
    机器学习之逻辑回归
    机器学习之决策树
    机器学*之K*邻
    机器学习之线性回归
    模型之各个指标
    模型之信息熵
    模型之决策树
  • 原文地址:https://www.cnblogs.com/zeroone/p/9732185.html
Copyright © 2011-2022 走看看