0

我有一个图表,它从代码隐藏中的 SQL 数据库获取数据。一切都正确显示,并且该系列在悬停时具有正确的数字。

这是一个堆叠条,显示此站点上的显示总计工作一轮。

http://www.telerik.com/support/kb/aspnet-ajax/chart-%28html5%29/details/displaying-grand-total-in-stacked-series-labels-and-pie-series-legend

我知道来自 SQL 的数据是一个数字,因为我将其转换为十进制。

gTotal 显示:“TL bbl: NaN”
如果我只做 TL bbls: #=dataItem.TotalRed# 它显示未定义的任何想法?

后面的代码:

    Dim daFMChart As New SqlDataAdapter(SQLFM, Conn)
    daFMChart.Fill(DTFMChart)

    Me.ColumnChart.DataSource = DTFMChart
    Me.ColumnChart.DataBind()

SQL数据是这个

+-------------------------------------------------+
| DateTime     TotalRed   TotalWhite       gTotal |
+-------------------------------------------------+
| 2016-03-25    20000        3             0.0001 |
| 2016-03-24    30000        2601          0.0001 |
| 2016-03-23    50000        45626         0.0001 |
| 2016-03-22    10000        55568         0.0001 |
| 2016-03-21    30000        54098         0.0001 |
| 2016-03-20    10000        51351         0.0001 |
| 2016-03-19    20000        21973         0.0001 |
+-------------------------------------------------+

<ChartTitle Text="Daily Volume Total Per Meter">
    <Appearance Align="Right" Position="Top">
        <TextStyle Color="#999999" />
    </Appearance>
</ChartTitle>

<Legend>
    <Appearance Position="Right" Visible="true">
        <TextStyle Color="#999999" />
    </Appearance>
</Legend>

<PlotArea>
    <Series>

        <telerik:ColumnSeries Name="FM Red" DataFieldY="TotalRed" Stacked="true">
            <LabelsAppearance Visible="false"></LabelsAppearance>
            <Appearance>
                <FillStyle BackgroundColor="#ff1a1a"></FillStyle>

            </Appearance>
        </telerik:ColumnSeries>

        <telerik:ColumnSeries Name="FM White" DataFieldY="TotalWhite">
            <LabelsAppearance Visible="false"></LabelsAppearance>
            <Appearance>
                <FillStyle BackgroundColor="#bfbfbf"></FillStyle>
            </Appearance>
        </telerik:ColumnSeries>

        <telerik:ColumnSeries DataFieldY="gTotal" Stacked="true">
            <Appearance FillStyle-BackgroundColor="#DDD9C3"></Appearance>
            <LabelsAppearance Position="OutsideEnd">
                <TextStyle Color="#999999" />
                <TextStyle Margin="0" />
                <ClientTemplate>
                        TL bbls: #=dataItem.TotalRed + dataItem.TotalWhite#
                </ClientTemplate>
            </LabelsAppearance>

            <TooltipsAppearance Visible="false">
            </TooltipsAppearance>
        </telerik:ColumnSeries>

    </Series>
    <XAxis DataLabelsField="DateTime"></XAxis>
    <XAxis>
        <MajorGridLines Visible="false" />
        <MinorGridLines Visible="false" />
        <LabelsAppearance Step="1">
            <TextStyle Color="#999999" />
        </LabelsAppearance>
    </XAxis>

    <YAxis>
        <MajorGridLines Visible="true" Color="#555555" />
        <MinorGridLines Visible="false" />
        <LabelsAppearance Step="1">
            <TextStyle Color="#999999" />
        </LabelsAppearance>
    </YAxis>
</PlotArea>

<ChartTitle Text=""></ChartTitle>

4

1 回答 1

0

你猜怎么着......它是一个错误。

不适用于 X 轴的日期列。

弄清楚这件事真是太痛苦了。

必须使用 3|24 作为字符串.. 不能使用 3/24

于 2016-03-26T03:55:53.567 回答