简体   繁体   English

不打印轴文本,也不绘制坐标

[英]Axis text isn't printed and coordinates aren't plotted

The following code will only display the standard graph, but will not print the axis text nor plot any of the coordinates. 以下代码将仅显示标准图形,而不会打印轴文本或绘制任何坐标。

public void JapaneseCandleStick()
{
    //GraphPane myPane = base.GraphPane;

    GraphPane myPane = new GraphPane();

    myPane.Title.Text = "Japanese Candlestick Chart Demo";
    myPane.XAxis.Title.Text = "Trading Date";
    myPane.YAxis.Title.Text = "Share Price, $US";

    StockPointList spl = new StockPointList();
    Random rand = new Random();

    // First day is jan 1st
    XDate xDate = new XDate(2006, 1, 1);
    double open = 50.0;

    for (int i = 0; i < 50; i++)
    {
        double x = xDate.XLDate;
        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;
        // Advance one day
        xDate.AddDays(1.0);
        // but skip the weekends
        if (XDate.XLDateToDayOfWeek(xDate.XLDate) == 6)
            xDate.AddDays(2.0);
    }

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

    // Use DateAsOrdinal to skip weekend gaps
    myPane.XAxis.Type = AxisType.DateAsOrdinal;

    // pretty it up a little
    myPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45.0f);
    myPane.Fill = new Fill(Color.White, Color.FromArgb(220, 220, 255), 45.0f);

    zedGraphControl1.AxisChange();
    //base.ZedGraphControl.AxisChange();
}

What is wrong with the above and why cannot I see any text or see the plots? 上面有什么问题,为什么我看不到任何文字或情节? It all compiles without errors, hence the referencing and the ZedGraph implementation/referencing seems to be in order. 编译过程没有错误,因此引用和ZedGraph实现/引用似乎是有序的。

when you create an instance of Graphpane it must be referenced to zedGraphControl1, use the following line of code : 当您创建Graphpane的实例时,必须将其引用到zedGraphControl1,使用以下代码行:

 GraphPane myPane = zedGraphControl1.GraphPane; 

& here's the output: &这是输出:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM