首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ZedGraph -添加阈值行

ZedGraph -添加阈值行
EN

Stack Overflow用户
提问于 2011-05-14 21:52:37
回答 1查看 6.9K关注 0票数 1

这可能很简单,但我无法弄清楚。我为每个操作系统性能计数器(Y->value,x->Time)绘制了一个线性图。现在我想为阈值Y添加一条水平线,比如红色,这样它就会和实际数据一起显示在图表中。我已经知道了每个计数器的阈值。

我该怎么做呢?

我目前这样做是为了在它自己的tabPage中显示一个性能计数器:

代码语言:javascript
复制
Cursor = Cursors.WaitCursor;
var perfCounter = PerfDictValues.Value.First(pc => pc.Counter == counter);
var tPage = new TabPage((tabControl1.TabPages.Count + 1).ToString());
tPage.Tag = perfCounter;
tPage.Padding = new Padding { All = 8 };

var zedGraph = new ZedGraphControl();
zedGraph.Dock = DockStyle.Fill;
var graphPane = zedGraph.GraphPane;
graphPane.Title.Text = counter;
graphPane.XAxis.Title.Text = String.Format("Max: {0}, Min: {1}, Avg: {2}", perfCounter.Maxm, perfCounter.Min, perfCounter.Average);
var curve = graphPane.AddCurve(counter, perfCounter.PointList, Color.Blue, SymbolType.Diamond); //Want to add a threshold value from perfCounter.Threshold property
 graphPane.XAxis.Type = AxisType.Linear;
 graphPane.AxisChange();

 tPage.Controls.Add(zedGraph);
 tabControl1.TabPages.Add(tPage);
 tabControl1.SelectedTab = tPage;
 grpOutput.Visible = true;
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-05-16 18:12:19

您可以通过向GraphObj列表添加LineObj在图形上绘制一条简单的红线,即这将绘制一条水平线

代码语言:javascript
复制
double threshHoldY = 2;
LineObj threshHoldLine = new LineObj(
    Color.Red,
    graphPane.XAxis.Scale.Min,
    threshHoldY,
    graphPane.XAxis.Scale.Max,
    threshHoldY);
graphPane.GraphObjList.Add(threshHoldLine);
票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6002252

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档