This is a migrated thread and some comments may be shown as answers.

Formatting negative values

1 Answer 84 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Pham
Top achievements
Rank 1
Pham asked on 02 Oct 2014, 10:27 AM
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>

1 Answer, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 06 Oct 2014, 12:16 PM
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.

 
Tags
Chart (Obsolete)
Asked by
Pham
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Share this question
or