自定义ZedGraph的LineItem的符号类型 [英] Customize symbol type of a ZedGraph LineItem

查看:938
本文介绍了自定义ZedGraph的LineItem的符号类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我绘制这样一个图<​​/ P>

I plot a graph like this

LineItem lineItem = new LineItem("label", pointList, Color.Black, SymbolType.Triangle);
lineItem.Line.IsVisible = _graphLineVisible;
zgc.GraphPane.CurveList.Add(lineItem);

我注意到,SymbolType有称为枚举元素用户定义,是有办法使用这个怎么样?

I notice that SymbolType have an enum element called UserDefined, is there a way to use this and how?

在理想情况下我会希望能够实现自己的符号,并用它来绘制的LineItem,这是可能的,我怎么会去这样做?

Ideally I would want to be able to implement my own Symbol and use it to draw a LineItem, is this possible and how could I go on about doing this?

推荐答案

下面是如何使用previously公布答案创建自定义箭头向下的符号,行了详细的说明:

Here is a detailed illustration of how to create custom arrow-down symbols, in line with the previously published answer:

var curve = zgc.GraphPane.AddCurve(null, new[] { 2.1, 2.6, 2.8 }, new[] { 1.8, 1.3, 1.1 }, Color.Blue);

curve.Symbol = new Symbol(SymbolType.UserDefined, Color.Red);
curve.Symbol.UserSymbol = new GraphicsPath(
    new[]
        {
            new PointF(-0.6f, -0.6f), new PointF(-0.6f, 0.6f), new PointF(-1.0f, 0.6f), new PointF(0f, 1.6f), 
            new PointF(1.0f, 0.6f), new PointF(0.6f, 0.6f), new PointF(0.6f, -0.6f),
            new PointF(-0.6f, -0.6f)
        },
    new[]
        {
            (byte)PathPointType.Start, (byte)PathPointType.Line, (byte)PathPointType.Line,
            (byte)PathPointType.Line, (byte)PathPointType.Line, (byte)PathPointType.Line,
            (byte)PathPointType.Line, (byte)PathPointType.Line
        });

运行此code会产生以下的输出:

Running this code would yield the following output:

这篇关于自定义ZedGraph的LineItem的符号类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆