Logarithmic Vertical and Horizontal Axes lines in MS Chart Control

一个人想着一个人 提交于 2020-01-20 08:31:45

问题


The image presents a logarithmic graph. I want to create a similar graph using MS Chart control. I know there is a way to convert normal graph to logarithmic graph but i am not able to create vertical and horizontal axes lines (light gray in color) similar to the graph below.


回答1:


You could try to set the chart's axes IsLogarithmic property to true and set up their MinorGrid as follows:

private static void SetupAxis(Axis axis)
{
    // Set the logarithmic scale mode:
    axis.IsLogarithmic = true;

    // Enable the minor grid lines:
    axis.MinorGrid.Enabled = true;
    // Set the color of the minor grid lines:
    axis.MinorGrid.LineColor = Color.Gray;
    // Set the inverval to 1:
    axis.MinorGrid.Interval = 1;

    // Enable the major grid lines:
    axis.MajorGrid.Enabled = true;
    // If not set, the major grid lines are defaulted to the black color
}

Usage:

ChartArea area = chart1.ChartAreas[0];

SetupAxis(area.AxisX);
SetupAxis(area.AxisY);


来源:https://stackoverflow.com/questions/26532175/logarithmic-vertical-and-horizontal-axes-lines-in-ms-chart-control

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