没有显示黑色的烛台图阴影

时间:2011-12-30 20:41:43

标签: c# winforms

我有这段代码来显示烛台图表。对于“test2”,正文颜色和边框颜色正在工作,但阴影颜色不正常。我将阴影称为顶部和底部的垂直线,如果它们位于身体上方或下方,则显示高点和低点。 (它们仍然显示为黄色,如下所示)根据一本书我认为它们被称为Shadowsnd使用了“Shadowcolor”,C#是否称它们为其他东西?

using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;

namespace PlotCharts
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Random rdn = new Random();

            chart1.Series["test1"].ChartType = SeriesChartType.Candlestick;
            chart1.Series["test1"].Color = Color.Red;
            chart1.Series["test1"].BorderColor = System.Drawing.Color.Black;

            chart1.Series["test2"].ChartType = SeriesChartType.Candlestick;
            chart1.Series["test2"].BorderColor = System.Drawing.Color.Black;
            chart1.Series["test2"].ShadowColor = System.Drawing.Color.Black;
            chart1.Series["test2"].Color = System.Drawing.Color.Yellow;


            for (int i = 0; i < 5; i++)
            {
                chart1.Series["test1"].Points.AddXY(i,4.5,4,3);
                chart1.Series["test2"].Points.AddXY(2.5,6,9,7,8);
            }




        }
    }
}

1 个答案:

答案 0 :(得分:1)

使用

chart1.Series["test2"].Color = System.Drawing.Color.Black;

而不是

chart1.Series["test2"].ShadowColor = System.Drawing.Color.Black;