Formatting negative values

Thread is closed for posting
2 posts, 0 answers
  1. DucAnh
    DucAnh avatar
    24 posts
    Member since:
    Aug 2011

    Posted 02 Oct 2014 Link to this post

    Hi everyone,
    I have a problem with formatting negative values. 
        I have number :   1234567,892 and I need format it:   12,334,567.892  
        I have number : - 1234567,892 and I need format it: - 12,334,567.892 
    But my result when I use DataFormatString "###,###,###.###":
         1234567,892    => 12,334,567.892  : Correct
       - 123,892            => - ,123,892            : Not correct   (I need -123,892)
         123,892            =>    ,123,892            : Not correct   (I need  123,892)
    Have you any ideas ?
    Thanks you very much !

    P/s: My code
     <telerik:RadHtmlChart runat="server" ID="rcProfile" Height="380px" PlotArea-Appearance-Visible="false">                                                
                                                    <PlotArea>
                                                        <Appearance>
                                                            <FillStyle BackgroundColor="White" />                                                        
                                                        </Appearance>
                                                        <Series>
                                                            <telerik:ColumnSeries DataFieldY="VAL_P" Name="Công suất" Stacked="false" ColorField="Blue"
                                                                Spacing="0" Gap="0">
                                                                <Appearance>
                                                                    <FillStyle BackgroundColor="#F0AD4E" />                                                                
                                                                </Appearance>
                                                                <LabelsAppearance Visible="false">
                                                                    <TextStyle Color="Red" />
                                                                </LabelsAppearance>
                                                                <LabelsAppearance DataFormatString="###,###,###,###.###"></LabelsAppearance>
                                                                <TooltipsAppearance BackgroundColor="White" DataFormatString="###,###,###,###.###" />
                                                            </telerik:ColumnSeries>
                                                        </Series>
                                                        <XAxis DataLabelsField="GIO_HTHI" >
                                                            <MajorGridLines Visible="false" Color="Blue" />
                                                            <MinorGridLines Visible="false" Color="Blue" />
                                                            <LabelsAppearance RotationAngle="75">
                                                            </LabelsAppearance>
                                                            <TitleAppearance Text="Thời gian">
                                                                <TextStyle FontFamily="Time new roman"  />
                                                            </TitleAppearance>
                                                        </XAxis>
                                                        <YAxis>
                                                            <MinorGridLines Visible="false" />
                                                            <MajorGridLines Color="WhiteSmoke" />
                                                            <TitleAppearance Text="kWh">
                                                                <TextStyle FontFamily="Time new roman" />
                                                            </TitleAppearance>
                                                        </YAxis>
                                                    </PlotArea>
                                                    <Legend>
                                                        <Appearance Visible="false">
                                                        </Appearance>
                                                    </Legend>
                                                    <ChartTitle Text="BIỂU ĐỒ PHỤ TẢI">
                                                        <Appearance>
                                                            <TextStyle Bold="true" FontFamily="Time new roman" Color="Blue" />
                                                        </Appearance>
                                                    </ChartTitle>
                                                </telerik:RadHtmlChart>
  2. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1494 posts

    Posted 06 Oct 2014 Link to this post

    Hello DucAnh,

    Custom format strings for numbers are not supported by the RadHtmlChart. You can use the "N3" specifier. For example:
    ASPX:
    <telerik:RadHtmlChart runat="server" ID="rcProfile" Height="380px" PlotArea-Appearance-Visible="false">
        <PlotArea>
            <Appearance>
                <FillStyle BackgroundColor="White" />
            </Appearance>
            <Series>
                <telerik:ColumnSeries DataFieldY="VAL_P" Name="Công suất" Stacked="false" ColorField="Blue"
                    Spacing="0" Gap="0">
                    <Appearance>
                        <FillStyle BackgroundColor="#F0AD4E" />
                    </Appearance>
                    <LabelsAppearance Visible="true">
                        <TextStyle Color="Red" />
                    </LabelsAppearance>
                    <LabelsAppearance DataFormatString="N3"></LabelsAppearance>
                    <TooltipsAppearance BackgroundColor="White" DataFormatString="N3" />
                </telerik:ColumnSeries>
            </Series>
            <XAxis DataLabelsField="GIO_HTHI">
                <MajorGridLines Visible="false" Color="Blue" />
                <MinorGridLines Visible="false" Color="Blue" />
                <LabelsAppearance RotationAngle="75">
                </LabelsAppearance>
                <TitleAppearance Text="Thời gian">
                    <TextStyle FontFamily="Time new roman" />
                </TitleAppearance>
            </XAxis>
            <YAxis>
                <MinorGridLines Visible="false" />
                <MajorGridLines Color="WhiteSmoke" />
                <TitleAppearance Text="kWh">
                    <TextStyle FontFamily="Time new roman" />
                </TitleAppearance>
            </YAxis>
        </PlotArea>
        <Legend>
            <Appearance Visible="false">
            </Appearance>
        </Legend>
        <ChartTitle Text="BIỂU ĐỒ PHỤ TẢI">
            <Appearance>
                <TextStyle Bold="true" FontFamily="Time new roman" Color="Blue" />
            </Appearance>
        </ChartTitle>
    </telerik:RadHtmlChart>

    More information is available in this help article.

    Regards,
    Danail Vasilev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top