showing all values in chart control Xaxis

前端 未结 2 652
轻奢々
轻奢々 2021-01-12 00:53

I have a chart of a bunch of products, 35 in all. They scale up the X Axis. The chart plots fine but only 5 of the product names show and I need them all to show. I have ena

相关标签:
2条回答
  • 2021-01-12 01:18

    chart control is very limited, if you want to customize it, you are better of creating your own chart, by generating an image:

    see link

    0 讨论(0)
  • 2021-01-12 01:34

    The answer lies in the Axis LabelStyles. The code below will format the axis (X or Y) so that all minor tick marks show, the interval is one and all the labels for each tickmark will show.

     cht.ChartAreas("MainChartArea").AxisX.MinorTickMark.Enabled = True
    cht.ChartAreas("MainChartArea").AxisX.Interval = 1
    cht.ChartAreas("MainChartArea").AxisX.IsLabelAutoFit = True
    'cht.ChartAreas("MainChartArea").AxisX.LabelStyle.IsStaggered = True
    cht.ChartAreas("MainChartArea").AxisX.LabelAutoFitStyle =  LabelAutoFitStyles.DecreaseFont
    

    Note: If you want the labels staggered then uncomment out the next to last line

    0 讨论(0)
提交回复
热议问题