C#实时曲线,鼠标在上面滚动时,图线怎也样实现随着鼠标滚动也变大缩小,我现在遇到的情况是,鼠标滚动,曲线变小时,左边没有显示,只有右边有实时曲线 我的实时曲线,在鼠标滚动,图线变小时,左边没有图线,没有坐标显示,只有右边有实时曲线,都移向了右边。能帮帮我吗?这个问题纠结好久了,老解决不了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using ZedGraph;namespace 我的实时曲线1{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } Random ran = new Random(); PointPairList list = new PointPairList(); PointPairList list2 = new PointPairList(); LineItem myCurve; private void Form1_Load(object sender, EventArgs e) { this.zedGraphControl1.GraphPane.Title.Text = "动态折线图"; this.zedGraphControl1.GraphPane.XAxis.Title.Text = "时间"; this.zedGraphControl1.GraphPane.YAxis.Title.Text = "数量"; this.zedGraphControl1.GraphPane.XAxis.Type = ZedGraph.AxisType.DateAsOrdinal; //this.zedGraphControl1.GraphPane.XAxis.Type = AxisType.Date; this.zedGraphControl1.GraphPane.XAxis.Scale.Format = "HH:mm:ss"; //this.zedGraphControl1.GraphPane.IsShowContextMenu = false; DateTime dt = DateTime.Now; for (int i = 0; i <= 100; i++) { double x = (double)new XDate(DateTime.Now.AddSeconds(-(50 - i))); double y = ran.NextDouble(); double x2= (double)new XDate(DateTime.Now.AddSeconds(-(80 - i))); double y2 = ran.NextDouble(); list.Add(x, y); list2.Add(x2, y2); } myCurve = zedGraphControl1.GraphPane.AddCurve("My Curve", list, Color.DarkGreen, SymbolType.None); //myCurve2 = zedGraphControl1.GraphPane.AddCurve("My Curve2", // list2, Color.Blue, SymbolType.None); ////LineItem myCurve = myPane.AddCurve("Porsche", //list1, Color.Red, SymbolType.Diamond); this.zedGraphControl1.AxisChange(); this.zedGraphControl1.Refresh(); } private void timer1_Tick(object sender, EventArgs e) { zedGraphControl1.GraphPane.XAxis.Scale.MaxAuto = true; double x = (double)new XDate(DateTime.Now); double y = ran.NextDouble(); double x2= (double)new XDate(DateTime.Now); double y2= ran.NextDouble(); //this.timer1.Tick += new System.EventHandler(this.timer1_Tick); list.Add(x, y); list2.Add(x2, y2); this.zedGraphControl1.AxisChange(); this.zedGraphControl1.Refresh(); if (myCurve.NPts > 100) { myCurve.RemovePoint(0); //myCurve2.RemovePoint(0); } } }}这个代码,有没有问题? 我有C#自定义统计图控件,qq:1277874734 我有C#自定义统计图控件,qq:1277874734 VB和C#之间,你为什么选择了C#? 关于手持POS机C#开发的几个问题 winform中panel控件如何实现立体样式? 为什么"在位置 0 处没有任何行。"啊 很急啊 啊 如何获取项目的引用文件列表 用C#生成Revit按钮 c# 中的DataGrid 问题 一个无序数组取前5项大的值,不能排序应该怎么写 求解C#中如何设置BUTTON点击它选中,再点击则取消选中? 怎么样编程实现自动登陆? winform用户控件border的颜色怎么改变? 请问下webservice与数据库进行交互的优缺点!!!这个会可靠吗?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ZedGraph;
namespace 我的实时曲线1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Random ran = new Random(); PointPairList list = new PointPairList();
PointPairList list2 = new PointPairList();
LineItem myCurve;
private void Form1_Load(object sender, EventArgs e)
{
this.zedGraphControl1.GraphPane.Title.Text = "动态折线图"; this.zedGraphControl1.GraphPane.XAxis.Title.Text = "时间"; this.zedGraphControl1.GraphPane.YAxis.Title.Text = "数量"; this.zedGraphControl1.GraphPane.XAxis.Type = ZedGraph.AxisType.DateAsOrdinal;
//this.zedGraphControl1.GraphPane.XAxis.Type = AxisType.Date;
this.zedGraphControl1.GraphPane.XAxis.Scale.Format = "HH:mm:ss";
//this.zedGraphControl1.GraphPane.IsShowContextMenu = false;
DateTime dt = DateTime.Now; for (int i = 0; i <= 100; i++)
{ double x = (double)new XDate(DateTime.Now.AddSeconds(-(50 - i))); double y = ran.NextDouble();
double x2= (double)new XDate(DateTime.Now.AddSeconds(-(80 - i))); double y2 = ran.NextDouble(); list.Add(x, y); list2.Add(x2, y2);
} myCurve = zedGraphControl1.GraphPane.AddCurve("My Curve", list, Color.DarkGreen, SymbolType.None); //myCurve2 = zedGraphControl1.GraphPane.AddCurve("My Curve2", // list2, Color.Blue, SymbolType.None);
////LineItem myCurve = myPane.AddCurve("Porsche",
//list1, Color.Red, SymbolType.Diamond);
this.zedGraphControl1.AxisChange(); this.zedGraphControl1.Refresh(); } private void timer1_Tick(object sender, EventArgs e)
{
zedGraphControl1.GraphPane.XAxis.Scale.MaxAuto = true; double x = (double)new XDate(DateTime.Now); double y = ran.NextDouble();
double x2= (double)new XDate(DateTime.Now); double y2= ran.NextDouble();
//this.timer1.Tick += new System.EventHandler(this.timer1_Tick); list.Add(x, y); list2.Add(x2, y2);
this.zedGraphControl1.AxisChange(); this.zedGraphControl1.Refresh();
if (myCurve.NPts > 100)
{
myCurve.RemovePoint(0);
//myCurve2.RemovePoint(0);
}
}
}
}
这个代码,有没有问题?