Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在visual studio中更改图表栏的颜色。C#Winforms_C#_Winforms_Charts - Fatal编程技术网

在visual studio中更改图表栏的颜色。C#Winforms

在visual studio中更改图表栏的颜色。C#Winforms,c#,winforms,charts,C#,Winforms,Charts,如何在设计时更改这些蓝色?我在前面找到了一个方法,但它只是改变了条上的颜色,而不是图例上的颜色 此图表可以根据用户显示许多数据,因此我需要它来更改所有数据的颜色。多谢各位 代码: 您可以使用调色板属性来使用不同的颜色: 选择任何可用的选项板 要添加自定义颜色,您可以在调色板自定义颜色属性中添加不同的颜色,然后将调色板属性设置为无谢谢您,先生。我在自定义调色板中添加了一种颜色。如何在自定义调色板中使用该颜色? private void loadchartFast() {

如何在设计时更改这些蓝色?我在前面找到了一个方法,但它只是改变了条上的颜色,而不是图例上的颜色

此图表可以根据用户显示许多数据,因此我需要它来更改所有数据的颜色。多谢各位

代码:


您可以使用
调色板
属性来使用不同的颜色:

选择任何可用的选项板


要添加自定义颜色,您可以在
调色板自定义颜色
属性中添加不同的颜色,然后将
调色板
属性设置为

谢谢您,先生。我在自定义调色板中添加了一种颜色。如何在自定义调色板中使用该颜色?
   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; ;
        }
    }