为ZedGraph JapaneseCandleStick图添加标题

时间:2013-11-25 10:39:57

标签: c# zedgraph

我为烛台创建了ZedGraph C#代码:

        GraphPane myPane = z1.GraphPane;
        StockPointList spl = new StockPointList();
        Random rand = new Random();

        XDate xDate = new XDate(2006, 2, 1, 10, 0, 0);
        double open = 1000.0;
        for (int i = 0; i < 360; i++)
        {
            double x = xDate.XLDate;
            xDate.AddMinutes(1);                              
            double close = open + rand.NextDouble() * 10.0 - 5.0;
            double hi = Math.Max(open, close) + rand.NextDouble() * 5.0;
            double low = Math.Min(open, close) - rand.NextDouble() * 5.0;
            StockPt pt = new StockPt(x, hi, low, open, close, 100000);
            spl.Add(pt);
            open = close;                   
        }

        JapaneseCandleStickItem myCurve = myPane.AddJapaneseCandleStick("trades", spl);
        myCurve.Stick.IsAutoSize = true;
        myCurve.Stick.Color = Color.Blue;

        myPane.XAxis.Type = AxisType.DateAsOrdinal;
        z1.AxisChange();

在此之后我添加高标记:

        foreach (StockPt sp in spl)
        {
            if (sp.Y > 1100)
            {

                TextObj text = new TextObj("Max", sp.X, sp.Y, CoordType.AxisXYScale);
                myPane.GraphObjList.Add(text);
                break;
            }
        }

        z1.Invalidate();

烛台画,文字不是。

如果我改变文字:

      PointPairList list = new PointPairList();
      list.Add(sp.X, sp.Y, sp.Z);
      LineItem line2 = new LineItem("Point", list, Color.Black, SymbolType.Circle);
      line2.Symbol.Size = 20;
      line2.Symbol.Fill = new Fill(Color.Red);
      myPane.CurveList.Add(line2);

50%的机会 - 不可见,或左侧可见(烛台图中的X轴可能不起作用?)

请帮忙..如何在烛台ZedGraph中绘制目标上的文字或圆圈?

0 个答案:

没有答案