MS 图表控制量表 - 线图显示 12 个月

发布于 2024-09-04 05:59:11 字数 3714 浏览 9 评论 0原文

在我的 X 轴上,我有几个月的时间。该图表最多显示 11 个点,即同年的 1 月 - 11 月,但是当我添加 12 个点(1 月 - 12 月)时,它将执行自动标签操作并每 4 个月更改一次间隔。

如何更改图表,使其显示自动标签之前的 12 个月?

这是我当前使用的服务器控制代码。

<asp:CHART ID="Chart1" runat="server" 
    BorderColor="181, 64, 1" BorderDashStyle="Solid" BorderWidth="2" Height="296px" 
    ImageLocation="~/TempImages/ChartPic_#SEQ(300,3)" ImageType="Png" 
    Palette="None" Width="700px" 
    BorderlineColor="">
        <legends>
            <asp:Legend BackColor="Transparent" 
                                    Font="Trebuchet MS, 8pt, style=Bold" 
                IsTextAutoFit="False" Name="Default" Alignment="Center" 
                DockedToChartArea="ChartArea1" Docking="Top" IsDockedInsideChartArea="False" 
                Title="Legend">
            </asp:Legend>
        </legends>
        <series>
            <asp:Series BorderColor="180, 26, 59, 105" BorderWidth="2" ChartType="Line" 
                                    Color="220, 65, 140, 240" MarkerSize="6" 
                Name="Series1" ShadowColor="Black" 
                                    ShadowOffset="2" XValueType="DateTime" YValueType="Double" 
                                    LabelFormat="c0" LegendText="Actual" 
                MarkerStyle="Circle">
            </asp:Series>
            <asp:Series BorderColor="180, 26, 59, 105" BorderWidth="2" ChartType="Line" 
                                    Color="220, 224, 64, 10" MarkerSize="6" Name="Series2" ShadowColor="Black" 
                                    ShadowOffset="2" XValueType="DateTime" YValueType="Double" 
                                    LabelFormat="c0" LegendText="Projected" 
                MarkerStyle="Circle">
            </asp:Series>
            <asp:Series BorderColor="180, 26, 59, 105" BorderWidth="2" 
                ChartArea="ChartArea1" ChartType="Line" 
                                    Legend="Default" Name="Series3" LabelFormat="c0" XValueType="DateTime" 
                                    YValueType="Double" Color="0, 192, 192" MarkerSize="6" 
                ShadowColor="Black" ShadowOffset="2" LegendText="Actual Credit Limit" 
                MarkerStyle="Circle">
            </asp:Series>
        </series>
        <chartareas>
            <asp:ChartArea BackColor="#DEEDF7" BackGradientStyle="TopBottom" 
                                    BackSecondaryColor="White" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid" 
                                    Name="ChartArea1" ShadowColor="Transparent">
                <area3dstyle inclination="40" isclustered="False" isrightangleaxes="False" 
                                        lightstyle="Realistic" perspective="9" rotation="25" wallwidth="3" />
                <axisy linecolor="64, 64, 64, 64" islabelautofit="False" 
                                        isstartedfromzero="False">
                    <LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" Format="c0" />
                    <majorgrid linecolor="64, 64, 64, 64" />
                </axisy>
                <axisx linecolor="64, 64, 64, 64" intervaloffsettype="Months" 
                                        intervaltype="Months" islabelautofit="False" isstartedfromzero="False">
                    <LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" Angle="-60" 
                                            Format="MMM yy" />
                    <majorgrid linecolor="64, 64, 64, 64" />
                </axisx>
            </asp:ChartArea>
        </chartareas>
    </asp:CHART>

谢谢。

On my X Axis, I have months. The chart shows up to 11 points, i.e. Jan - Nov of the same year, but when I add 12 points (Jan - Dec), it will do an auto label thing and change the interval for every 4 months.

How can I change the graph so that it shows 12 months before it does the auto labels?

Here is the server control code I am currently using.

<asp:CHART ID="Chart1" runat="server" 
    BorderColor="181, 64, 1" BorderDashStyle="Solid" BorderWidth="2" Height="296px" 
    ImageLocation="~/TempImages/ChartPic_#SEQ(300,3)" ImageType="Png" 
    Palette="None" Width="700px" 
    BorderlineColor="">
        <legends>
            <asp:Legend BackColor="Transparent" 
                                    Font="Trebuchet MS, 8pt, style=Bold" 
                IsTextAutoFit="False" Name="Default" Alignment="Center" 
                DockedToChartArea="ChartArea1" Docking="Top" IsDockedInsideChartArea="False" 
                Title="Legend">
            </asp:Legend>
        </legends>
        <series>
            <asp:Series BorderColor="180, 26, 59, 105" BorderWidth="2" ChartType="Line" 
                                    Color="220, 65, 140, 240" MarkerSize="6" 
                Name="Series1" ShadowColor="Black" 
                                    ShadowOffset="2" XValueType="DateTime" YValueType="Double" 
                                    LabelFormat="c0" LegendText="Actual" 
                MarkerStyle="Circle">
            </asp:Series>
            <asp:Series BorderColor="180, 26, 59, 105" BorderWidth="2" ChartType="Line" 
                                    Color="220, 224, 64, 10" MarkerSize="6" Name="Series2" ShadowColor="Black" 
                                    ShadowOffset="2" XValueType="DateTime" YValueType="Double" 
                                    LabelFormat="c0" LegendText="Projected" 
                MarkerStyle="Circle">
            </asp:Series>
            <asp:Series BorderColor="180, 26, 59, 105" BorderWidth="2" 
                ChartArea="ChartArea1" ChartType="Line" 
                                    Legend="Default" Name="Series3" LabelFormat="c0" XValueType="DateTime" 
                                    YValueType="Double" Color="0, 192, 192" MarkerSize="6" 
                ShadowColor="Black" ShadowOffset="2" LegendText="Actual Credit Limit" 
                MarkerStyle="Circle">
            </asp:Series>
        </series>
        <chartareas>
            <asp:ChartArea BackColor="#DEEDF7" BackGradientStyle="TopBottom" 
                                    BackSecondaryColor="White" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid" 
                                    Name="ChartArea1" ShadowColor="Transparent">
                <area3dstyle inclination="40" isclustered="False" isrightangleaxes="False" 
                                        lightstyle="Realistic" perspective="9" rotation="25" wallwidth="3" />
                <axisy linecolor="64, 64, 64, 64" islabelautofit="False" 
                                        isstartedfromzero="False">
                    <LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" Format="c0" />
                    <majorgrid linecolor="64, 64, 64, 64" />
                </axisy>
                <axisx linecolor="64, 64, 64, 64" intervaloffsettype="Months" 
                                        intervaltype="Months" islabelautofit="False" isstartedfromzero="False">
                    <LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" Angle="-60" 
                                            Format="MMM yy" />
                    <majorgrid linecolor="64, 64, 64, 64" />
                </axisx>
            </asp:ChartArea>
        </chartareas>
    </asp:CHART>

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一紙繁鸢 2024-09-11 05:59:11

尝试将图表的宽度更改为更高的值...

<asp:Chart ID="Chart1" runat="server" 
BorderColor="181, 64, 1" BorderDashStyle="Solid" BorderWidth="2" Height="296px" 
ImageLocation="~/TempImages/ChartPic_#SEQ(300,3)" ImageType="Png" 
Palette="None" Width="800px" 
BorderlineColor="">

尝试将 axisx 上的 inverval 属性设置为 1:

 <axisx Interval="1" linecolor="64, 64, 64, 64" intervaloffsettype="Months" 
  intervaltype="Months" islabelautofit="False" isstartedfromzero="False">

要完全了解如何格式化图表轴,请查看:

格式化图表上的轴标签

替代文字< /a>
(来源:
microsoft.com

图表如何计算轴标签间隔?

类别轴上,最小值和最大值类型取决于类别字段的类型。数据集中的任何字段都可以分为三种类别字段类型之一:数字、日期/时间和字符串。

在类别轴上显示所有标签

在值轴上,轴间隔提供图表上数据点的一致度量。但是,在类别轴上,此功能可能会导致类别显示时没有轴标签。通常,您希望对所有类别进行标记。您可以将间隔数设置为 1 以显示所有类别。有关详细信息,请参阅 如何:指定轴间隔

Try to change the Chart's Width to a higher value...

<asp:Chart ID="Chart1" runat="server" 
BorderColor="181, 64, 1" BorderDashStyle="Solid" BorderWidth="2" Height="296px" 
ImageLocation="~/TempImages/ChartPic_#SEQ(300,3)" ImageType="Png" 
Palette="None" Width="800px" 
BorderlineColor="">

Try to set the inverval property to 1 on axisx:

 <axisx Interval="1" linecolor="64, 64, 64, 64" intervaloffsettype="Months" 
  intervaltype="Months" islabelautofit="False" isstartedfromzero="False">

To fully understand how to format chart axis, take a look at:

Formatting Axis Labels on a Chart

alt text
(source: microsoft.com)

How the Chart Calculates Axis Label Intervals?

On the category axis, the minimum and maximum value types are determined depending on the type of your category field. Any field in a dataset can be categorized into one of three category field types: Numeric, Date/Time and Strings.

Displaying All Labels on the Category Axis

On the value axis, axis intervals provide a consistent measure of the data points on the chart. However, on the category axis, this functionality can cause categories to appear without axis labels. Typically, you want all categories to be labeled. You can set the number of intervals to 1 to show all categories. For more information, see How to: Specify an Axis Interval.

顾北清歌寒 2024-09-11 05:59:11

使用 Microsoft 图表

chart.ChartAreas[0].AxisY.ScaleBreakStyle = true 

以自己的 Y 值在 Y 轴上绘制第二组值的图表

Use Microsoft chart

chart.ChartAreas[0].AxisY.ScaleBreakStyle = true 

to chart the second set of values in thier on Y Axis with thier own Y values

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文