c# - 如何在 ASP.Net 图表控件中标记每周图表

标签 c# asp.net

我有以下图表显示用户每周步行。目前它显示日期。有什么专业的方法可以显示周数据。 enter image description here

下面的代码用于生成图表

 <asp:Chart ID="Chart2" runat="server" Height="450" Palette="Fire" CssClass="col-md-12">
                <Series>
                    <asp:Series Name="Series1" XValueMember="xdate" YValueMembers="TimePerDay" ChartArea="ChartArea2" ChartType="column" YValuesPerPoint="6" IsValueShownAsLabel="true" LabelFormat="{0:N0}" IsXValueIndexed="true">
                    </asp:Series>
                </Series>
                <ChartAreas>
                    <asp:ChartArea Name="ChartArea2">
                        <AxisY Interval="60">
                            <MajorGrid Enabled="true" LineColor="lightgray" />
                            <StripLines>
                                <asp:StripLine TextAlignment="Near" BorderDashStyle="Solid" BorderColor="#0000ff" BorderWidth="2" BackColor="#0000ff" />
                                <asp:StripLine BorderWidth="5" />
                            </StripLines>
                        </AxisY>
                        <AxisX IsLabelAutoFit="false" TitleForeColor="black" Interval="1">
                            <LabelStyle Format="dd-MM-yy" Angle="-90" IsEndLabelVisible="true" />
                            <MajorGrid Enabled="false" />
                        </AxisX>
                    </asp:ChartArea>
                </ChartAreas>
                                </asp:Chart>

最佳答案

在尝试将周数据推送到图表中时,我一直在 excel 中使用周编号,但是您的 x 轴实际上需要是一个类似于“yyyy-ww”或 2015-32 的字符串,这样它才能正确排序和排序在图表中。

Get the correct week number of a given date

关于c# - 如何在 ASP.Net 图表控件中标记每周图表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32059936/

相关文章:

c# - HttpContext和TelemetryInitializer

asp.net - 如何在查询字符串中传递 '#'

asp.net - 找不到WebResources的原因

jquery - 将样式应用于 ASP.NET RadioButtonList

html - Bootstrap 下拉不会下拉

c# - Repeater 内的 Linkbutton 用于分页 ASP.Net

c# - 将值舍入到最接近的 2 的幂

c# - Dns.GetHostEntry 在 Windows Mobile 上返回错误的 IP 地址

c# - <logger> 的 log4net 过滤不起作用

c# - 测试未观察到的异常