![](/img/trans.png)
[英]How to trim the values of x on X-axis in Chart control in Winforms?
[英]Winforms - How to get label in between of the x-axis datapoints
System.Web.UI.DataVisualization.Charting
System.Windows.Forms.DataVisualization.Charting
條形圖-當前:
條形圖-必填:
或這個:
我可以在x軸刻度之間插入標簽嗎?
謝謝!
找到了解決方案!
1)更改AxisX刻度位置。
chart1.ChartAreas[0].AxisX.MajorTickMark.IntervalOffset =
chart1.ChartAreas[0].AxisX.Interval / 2f;
2)設置自定義標簽
int startOffset = 0;
int endOffset = 1;
for (int i = earliestHour; i <= latestHour; i++)
{
CustomLabel label_chart = new CustomLabel(startOffset, endOffset, xAxis_Label,0, LabelMarkStyle.None);
chart1.ChartAreas[0].AxisX.CustomLabels.Add(label_chart);
startOffset+=1;
endOffset+=1;
}
而且...你明白了!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.