gpt4 book ai didi

C# Zedgraph 改变短划线长度

转载 作者:行者123 更新时间:2023-11-30 20:05:50 26 4
gpt4 key购买 nike

我正在尝试更改 Zed 图表线上破折号的长度。我希望实线之间有更大的间隙。

我的代码示例

LineItem LineCurve = null
LineCurve = ZedGraphControl.GraphPane.AddCurve("line1",PairPointListData, Color, Symbol);
//now I want to change the dash settings
LineCurve.Line.Style = System.Drawing.Drawing2D.DashStyle.Dash;
LineCurve.Line.StepType = StepType.ForwardStep;
LineCurve.Line.DashOn = 1.0f;//Not sure what this floating point does
LineCurve.Line.DashOff = 1.0f;//Also not sure

我已经更改了 Dash On 和 Off 的值,但我看不到任何明显的东西。

最佳答案

您的破折号样式必须设置为“自定义”。看: http://zedgraph.sourceforge.net/documentation/html/P_ZedGraph_LineBase_DashOff.htm

下面是一些示例代码:

        double[] xvals = new double[100];
double[] yvals = new double[100];

for (double i = 0; i < xvals.Length; i++)
{
xvals[(int)i] = i / 10;
yvals[(int)i] = Math.Sin(i / 10);
}

var zgc = msGraphControl1.zedGraphControl1;
var lineItem = zgc.GraphPane.AddCurve("Custom", xvals, yvals, Color.Blue);

lineItem.Line.Style = DashStyle.Custom;
lineItem.Line.Width = 3;
lineItem.Line.DashOn = 5;
lineItem.Line.DashOff = 10;

//offset the next curve
for (int i = 0; i < xvals.Length; i++)
{
xvals[i] = xvals[i] + 0.5;
yvals[i] = yvals[i] + 0.05;
}

var lineItem2 = zgc.GraphPane.AddCurve("DashDotDot", xvals, yvals, Color.Red);

lineItem2.Line.Width = 3;
lineItem2.Line.Style = DashStyle.DashDotDot;

//offset the next curve
for (int i = 0; i < xvals.Length; i++)
{
xvals[i] = xvals[i] + 0.5;
yvals[i] = yvals[i] + 0.05;
}

var lineItem3 = zgc.GraphPane.AddCurve("Solid", xvals, yvals, Color.Black);

lineItem3.Line.Width = 3;
lineItem3.Line.Style = DashStyle.Solid;


zgc.AxisChange();
zgc.Refresh();

关于C# Zedgraph 改变短划线长度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10517941/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com