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

Format the value (HH:mm:ss) on the top of the bars

1 Answer 25 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Luka
Top achievements
Rank 1
Luka asked on 05 Apr 2013, 08:55 AM
I have the WPF:

<telerik:RadChart x:Name="reasonChart" ItemsSource="{Binding ReasonChart, Mode=TwoWay}">
    <telerik:RadChart.SeriesMappings>
        <telerik:SeriesMapping LegendLabel="Devices">
            <telerik:SeriesMapping.SeriesDefinition>
                <telerik:BarSeriesDefinition></telerik:BarSeriesDefinition>
            </telerik:SeriesMapping.SeriesDefinition>
            <telerik:SeriesMapping.ItemMappings>
                <telerik:ItemMapping DataPointMember="Label" FieldName="Value"></telerik:ItemMapping>
                <telerik:ItemMapping DataPointMember="YValue" FieldName="Value"></telerik:ItemMapping>
                <telerik:ItemMapping DataPointMember="XCategory" FieldName="Label"/>
            </telerik:SeriesMapping.ItemMappings>
        </telerik:SeriesMapping>
    </telerik:RadChart.SeriesMappings>
</telerik:RadChart>

Instead of the Value for the Label I would like to format the seconds in the HH:mm:ss format! See the image attached!
Excepted result:
120s => 00:02:00

1 Answer, 1 is accepted

Sort by
0
Petar Kirov
Telerik team
answered on 09 Apr 2013, 12:58 PM
Hi Luka,

You can introduce a Label property to your data item class like this: 
public string Label
{
    get
    {
        return TimeSpan.FromSeconds(this.Value).ToString();
    }
}
and then bind the series item labels to it: 
<telerik:ItemMapping DataPointMember="Label" FieldName="Label"/>

I hope this helps.
 
All the best,
Petar Kirov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Chart
Asked by
Luka
Top achievements
Rank 1
Answers by
Petar Kirov
Telerik team
Share this question
or