开发者

.net chart controls - show values in mm:ss

开发者 https://www.devze.com 2023-01-23 02:39 出处:网络
I am plotting data on a .net chart control, and I want to display values on the x-axis in in minutes an开发者_如何学Cd seconds (mm:ss).For example, instead of displaying 1.5, I would like the axis to

I am plotting data on a .net chart control, and I want to display values on the x-axis in in minutes an开发者_如何学Cd seconds (mm:ss). For example, instead of displaying 1.5, I would like the axis to show 1:30. Any ideas?


I've just tried this using the Visiblox Silverlight charting API. It is possible with the following code:

<charts:Chart Name="chart">
    <charts:Chart.XAxis>
        <charts:DateTimeAxis LabelFormatString="mm:ss" />
    </charts:Chart.XAxis>
</charts:Chart>

You should be able to apply something similar to other charting controls.

Edit: Sorry, just notice that you are using the MS Charting library, the documentation does not mention a LabelFormatString but you should be able to set one in the style: http://msdn.microsoft.com/en-us/library/system.windows.forms.datavisualization.charting.axis.labelstyle.aspx . You can use the Format property on the LabelStyle class here: system.windows.forms.datavisualization.charting.labelstyle.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消