iT邦幫忙

0

MS Chart control Y軸無法設定最大值

SKY 2021-11-19 17:24:331123 瀏覽
  • 分享至 

  • xImage
        ChartArea chartArea1 = new ChartArea("CA1");
        chart1.ChartAreas.Add(chartArea1);
        Series series1 = new Series("Series1");
        
        chart1.Series.Add(series1);            

        chart1.Series["Series1"].Points.AddY(8);
        chart1.Series["Series1"].Points.AddY(7);
        chart1.Series["Series1"].Points.AddY(6);
        chart1.Series["Series1"].Points.AddY(5);
        chart1.Series["Series1"].Points.AddY(4);

        chart1.Series["Series1"].ChartType = SeriesChartType.Column;           
        chart1.Series["Series1"]["LineTension"] = "0.6";
        chart1.Series["Series1"].IsValueShownAsLabel = true;
        
        chart1.Series["Series1"].MarkerStyle = MarkerStyle.Circle;
        chart1.Series["Series1"].MarkerColor = Color.Magenta;

        // Disable X axis margin
        chart1.ChartAreas["CA1"].AxisX.IsMarginVisible = false;
        
        chart1.ChartAreas["CA1"].AxisY.IsLogarithmic = !true;            
        chart1.ChartAreas["CA1"].AxisY.Maximum = 30;
        chart1.ChartAreas["CA1"].AxisY.IsStartedFromZero = false;            
        
        chart1.Series["Series1"].Color = Color.FromArgb(120, 0, 155, 155);

/* 我有設最大值:
chart1.ChartAreas["CA1"].AxisY.Maximum = 30;
照理說我執行後應該最大應是30, 但出來卻是10,
不知道為什麼, 求教~
*/

SKY iT邦新手 5 級 ‧ 2021-11-20 00:19:32 檢舉
找到原因了, 應該是ChartArea和Series沒對應好
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答