MSChart 双Y轴 自适应,轴刻度坐标值美化

题记:今天是要爆发了,要反哺尽点力

Chart有很多,前端的如HeightChart...连百度都搞了一个。微软MSChart依旧停滞不前,没想到这会显示出 落后的优点了。

 双Y轴 自适应

Series def = new Series();
def.YAxisType = AxisType.Secondary;
chartArea.AxisY2.Maximum =  data.Max().ToString(); 
chartArea.AxisY2.Minimum =  data.Min().ToString() ;


Series def2 = new Series();
def2.YAxisType = AxisType.Secondary;
chartArea.AxisY2.Maximum = Utils.ToDouble(data.Max(), 1);
chartArea.AxisY2.Minimum = Utils.ToDouble(data.Min(), 0);


chartArea.AxisY.IsLabelAutoFit = true;
chartArea.AxisY2.IsLabelAutoFit = true;

//轴坐标刻度小数点
chartArea.AxisY.LabelStyle.Format = @"{0:0.#}";
chartArea.AxisY2.LabelStyle.Format = @"{0:0.#}"; 

  

原文地址:https://www.cnblogs.com/recordman/p/4568358.html