如何在设计时改变那些蓝色?我之前找到了一种方法,但它只改变了条形图上的颜色而不是图例。
此图表可以根据用户显示许多数据,因此我需要它来更改所有数据的颜色。谢谢
代码:
private void loadchartFast()
{
chart1.Series[0].Points.Clear();
chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1;
using (SqlConnection connection = new SqlConnection("Data Source=BENJOPC\\SQLEXPRESS;Initial Catalog=MARISCHELLdatabase;Integrated Security=True"))
{
SqlCommand command = new SqlCommand("SELECT TOP 5 ProductName, Sum(QtySold) as QtySold FROM Sales_productholder group by ProductName order by SUM(QtySold) desc", connection); //top selling with desc
connection.Open();
SqlDataReader read = command.ExecuteReader();
while (read.Read())
{
this.chart1.Series["Pieces Sold"].Points.AddXY(read["ProductName"], read["QtySold"]);
}
read.Close();
// chart3.Series["Pieces Sold"].Points[0].Color = Color.LightSeaGreen; ;
}
}