首页 > 代码库 > chartControl
chartControl
关键代码:
/// <summary> /// 设置X轴Title /// </summary> /// <param name="chart">ChartControl</param> /// <param name="titleText">Title文字</param> /// <param name="titleColor">Title文字颜色</param> public static void SetAxisXTitle(this ChartControl chart, string titleText, Color titleColor) { XYDiagram _diagram = (XYDiagram)chart.Diagram; if (_diagram != null) { _diagram.AxisX.Title.Visible = true; _diagram.AxisX.Title.Alignment = StringAlignment.Center; _diagram.AxisX.Title.Text = titleText; _diagram.AxisX.Title.TextColor = titleColor; _diagram.AxisX.Title.Antialiasing = true; _diagram.AxisX.Title.Font = new Font("Tahoma", 14, FontStyle.Bold); } } /// <summary> /// 设置Y轴Title /// </summary> /// <param name="chart">ChartControl</param> /// <param name="titleText">Title文字</param> /// <param name="titleColor">Title文字颜色</param> public static void SetAxisYTitle(this ChartControl chart, string titleText, Color titleColor) { XYDiagram _diagram = (XYDiagram)chart.Diagram; if (_diagram != null) { _diagram.AxisY.Title.Visible = true; _diagram.AxisY.Title.Alignment = StringAlignment.Center; _diagram.AxisY.Title.Text = titleText; _diagram.AxisY.Title.TextColor = titleColor; _diagram.AxisY.Title.Antialiasing = true; _diagram.AxisY.Title.Font = new Font("Tahoma", 14, FontStyle.Bold); } }
代码使用:
chartControl1.SetAxisXTitle("时间x轴演示", Color.Red); chartControl1.SetAxisYTitle("时间y轴演示", Color.Red);
运行效果:
chartControl
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。