How to display logarithmic x-axis minor label?

跟風遠走 提交于 2020-01-05 12:13:00

问题


I set x-axis as logarithmic scale, but it only displays the major labels, exp : 1E000, 1E001, 1E002, etc... Now i also want to display the minor values, for example : 2E000, 3E000, 4E000,..., 2E001, 3E001, .....

it should look like the graph below :

It seems a simple question but i can't find the way to solve this problem. Can anyone help me ?

Thanks in advance.


回答1:


This question is similar to this one.

It took me a long time to solve this one, but:

If you if you set the MinorGrid Interval to 1, then you get the traditional Logarithmic grid marks, ten per decade:

aChart.ChartAreas[0].AxisX.IsLogarithmic = true;
aChart.ChartAreas[0].AxisX.MinorGrid.Interval = 1;
aChart.ChartAreas[0].AxisX.MinorGrid.Enabled = true;



回答2:


As far as I know, the only way to do this is by setting the interval property of the axis.LabelStyle e.g.:

this.chart1.ChartAreas[0].AxisX.LabelStyle.Interval = 0.1;

For example, setting 0.1 in a logaritmic scale, the labels show will be 10^0.1, 10^0.2, 10^0.3 ...

If you need something more particular, I suggest you to create the labels manually using the property axis.CustomLabels, even if is not so intuitive...



来源:https://stackoverflow.com/questions/9762059/how-to-display-logarithmic-x-axis-minor-label

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!