MS Chart Control中的对数垂直轴和水平轴线 [英] Logarithmic Vertical and Horizontal Axes lines in MS Chart Control

查看:230
本文介绍了MS Chart Control中的对数垂直轴和水平轴线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

图像呈现对数图.我想使用MS Chart控件创建类似的图形.我知道有一种方法可以将法线图转换为对数图,但是我无法创建类似于下图的垂直和水平轴线(浅灰色).

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.

推荐答案

您可以尝试将图表的轴IsLogarithmic属性设置为true并按如下所示设置其MinorGrid:

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
}

用法:

ChartArea area = chart1.ChartAreas[0];

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

这篇关于MS Chart Control中的对数垂直轴和水平轴线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆