本文介绍了如何使用Windows.Forms.DataVisualization.Charting控件在图形中绘制趋势线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经使用System.Windows.Forms.DataVisualization.Charting绘制了图表
我需要在图形中绘制趋势线,
我怎么画呢?
有什么提示吗?
在此先感谢
I have draw a chart using System.Windows.Forms.DataVisualization.Charting
I need to draw Trendline in graph,
how can i draw that ?
any hint ?
Thanks in advance
推荐答案
chartCoRel.Series.Add("TrendLine");
chartCoRel.Series["TrendLine"].ChartType = SeriesChartType.Line;
chartCoRel.Series["TrendLine"].BorderWidth = 3;
chartCoRel.Series["TrendLine"].Color = Color.Red;
// Line of best fit is linear
string typeRegression = "Linear";//"Exponential";//
// The number of days for Forecasting
string forecasting = "1";
// Show Error as a range chart.
string error = "false";
// Show Forecasting Error as a range chart.
string forecastingError = "false";
// Formula parameters
string parameters = typeRegression + '','' + forecasting + '','' + error + '','' + forecastingError;
chartCoRel.Series[0].Sort(PointSortOrder.Ascending, "X");
// Create Forecasting Series.
chartCoRel.DataManipulator.FinancialFormula(FinancialFormula.Forecasting, parameters, chartCoRel.Series[0], chartCoRel.Series["TrendLine"]);
这篇关于如何使用Windows.Forms.DataVisualization.Charting控件在图形中绘制趋势线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!