I am using MSChart in Visual Studio 2013 and am getting some really weird results. On a line chart, when graphing the points, the labels show lower valued points as higher on the chart, which is visually confusing. See the following:
The chart labels are set as follows:
recentFailureChart.Series["FailureCount"].BorderWidth = 3;
recentFailureChart.Series["FailureCount"].Color = Color.Red;
recentFailureChart.Series["FailureCount"].LabelBackColor = Color.Red;
recentFailureChart.Series["FailureCount"].LabelBorderColor = Color.Black;
recentFailureChart.Series["FailureCount"].LabelBorderDashStyle = ChartDashStyle.Solid;
recentFailureChart.Series["FailureCount"].LabelBorderWidth = 1;
recentFailureChart.Series["FailureCount"].LabelForeColor = Color.White;
SmartLabelStyle smartLabel = new SmartLabelStyle();
smartLabel.AllowOutsidePlotArea = LabelOutsidePlotAreaStyle.Partial;
smartLabel.IsMarkerOverlappingAllowed = true;
recentFailureChart.Series["FailureCount"].SmartLabelStyle = smartLabel;
in the constructor and in the function adding the points:
recentFailureChart.Series["FailureCount"].Points.InsertY(0, failCount);
recentFailureChart.Series["FailureCount"].Points[0].Font = labelFont;
Any ideas on how to get them in the correct order, or even over the points themselves?
我看不到上面的“图表图像”有什么问题,点14和12正确地绘制在5、3和1较低点的上方。我注意到的唯一一点是,并不是所有的点都在图表中可见,可以通过使用Chart1.ChartAreas(0).AxisY.Maximum = 100将Y轴的最大值设置为较高的值(例如100)来更改此值。
I believe the properties you are looking for are these:
MaxMovingDistance
MinMovingDistance
MovingDirection
AllowOutsidePlotArea
A. Set AllowOutsidePlotArea if it is acceptable for the label to overlap the X-Axis.
B. Set MovingDirection to Top in order to force all labels to be displayed over the DataPoint.
C. You could also make the X-Axis cross the Y-Axis on -2 or something similar, making room for the smartlabels inside the plotarea.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.