2014-02-17 61 views
3

如何更改圖表標籤的前面顏色?這裏是圖表的截圖 enter image description here如何更改圖表標籤的前景色?

我試過使用chart1.series [0] .FontForeColor = color.white;但整個圖表變成白色。

+0

http://stackoverflow.com/a/9641090/2186128我認爲這個線程是相似的。研究一下。 –

+0

我的圖表中的值是動態的,我沒有足夠的時間來重建我的圖表。我希望找到一些我可以直接使用而不必重新開始。 –

回答

2

試試這個:

 this.chart1.BackColor = Color.AliceBlue; 

     this.chart1.ChartAreas[0].AxisX.LineColor = Color.Red; 
     this.chart1.ChartAreas[0].AxisX.MajorGrid.LineColor = Color.Red; 
     this.chart1.ChartAreas[0].AxisX.LabelStyle.ForeColor = Color.Red; 

     this.chart1.ChartAreas[0].AxisY.LineColor = Color.Red; 
     this.chart1.ChartAreas[0].AxisY.MajorGrid.LineColor = Color.Red; 
     this.chart1.ChartAreas[0].AxisY.LabelStyle.ForeColor = Color.Red; 

這裏LabelStyle.ForeColor更改標籤顏色,你的要求。

屬性LineColorMajorGrid.LineColor允許修改網格線(在屏幕截圖上爲黑色),以防您也需要修改。紅色和AliceBlue的顏色當然只是一個例子。