0

我想知道如何删除股票图表上的 3 条水平红线,如下图所示。请忽略图像上不相关的点/正方形。我想我已经搜索了每一个谷歌页面,并浏览了 asp.net 的每一个选项......但无法弄清楚。任何帮助是极大的赞赏!

在此处输入图像描述

生成此图的代码:

Double[] test = new Double[] { 10, 50 };

    Chart1.Series[0].ChartType = SeriesChartType.Stock;
    Chart1.Series[0].YAxisType = AxisType.Primary;
    Chart1.Series[0].Color = Color.Red;
    Chart1.Series[0].BorderWidth = 10;
    Chart1.ChartAreas[0].AxisY.MajorGrid.Enabled = false;
    Chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = false;
    Chart1.Series[0]["PixelPointWidth"] = "5";

    Chart1.Series.Add(new Series("Test Series"));
    Chart1.Series[1].ChartType = SeriesChartType.Point;
    Chart1.Series[1].YAxisType = AxisType.Primary;
    Chart1.Series[1].Color = Color.Black;
    Chart1.Series[1].BorderWidth = 3;
    Chart1.Series[1].MarkerSize = 15;

    Chart1.Series.Add(new Series("New Series"));
    Chart1.Series[2].ChartType = SeriesChartType.Point;
    Chart1.Series[2].YAxisType = AxisType.Primary;
    Chart1.Series[2].Color = Color.Orange;
    Chart1.Series[2].BorderWidth = 3;
    Chart1.Series[2].MarkerSize = 15;

    Chart1.Series[0].Points.Add(new Double[] {-10, 50});
    Chart1.Series[1].Points.Add(25);
    Chart1.Series[2].Points.Add(20);

    for (int i = 0; i < 2; i++)
    {
        Chart1.Series[0].Points.Add(test);
        Chart1.Series[1].Points.Add(25);
        Chart1.Series[2].Points.Add(20);
    }
4

1 回答 1

1

好的,在痴迷地研究之后,我认为我有一个解决方案。只需添加两个 Y 值,图表的标记默认值为零(高还是低?)。通过指定您将添加四个值(开盘价、收盘价、最高价、最低价 - 不确定高/低顺序),您可以通过使它们落在您的开盘/收盘范围内并将 PixelPointWidth 设置为等于或小于您的 BorderWidth。

// IMPORTANT: add the ", 4" to indicate that you have the four Y values
Chart1.Series.Add(new Series("Stock", 4)); 
Chart1.Series["Stock"].ChartType = SeriesChartType.Stock;
Chart1.Series["Stock"].YAxisType = AxisType.Primary;
Chart1.Series["Stock"].Color = Color.Red;
Chart1.Series["Stock"].BorderWidth = 10;
Chart1.ChartAreas[0].AxisY.MajorGrid.Enabled = false;
Chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = false;

// Set <= BorderWidth, so that it's effectively hidden
Chart1.Series["Stock"]["PixelPointWidth"] = "10"; 
Chart1.Series["Stock"].Points.AddY(10, 50, 20, 30); // open, close, high, low.

这有点难以追踪。唷。

于 2013-05-29T14:01:54.093 回答