User (Legacy) Posted November 23, 2004 Report Share Posted November 23, 2004 I have a graph to generate that shows the total number of minutes accrued on a project for several different types of work. However, I need to display the time in hours and minutes, not simply minutes by themselves. Right now I have it calculated with hours totaled, and minutes as a decimal value after the total hours (like 200.50 would be 200 hrs 30 minutes). The latter is how I would like it to display, although I can't figure out a way of doing this in ChartFx.net. Any help would be greatly appreciated. - Nolan Link to comment Share on other sites More sharing options...
Software FX Posted November 24, 2004 Report Share Posted November 24, 2004 So you are charting Time Spans ? If so, we currently do not support Time-Spans as an Axis format. We do support Date-Time. The difference is that DateTime is ABSOLUTE, meaning the values you pass correspond to an specific date and time (e.g. Jan 2, 2004 1240 pm). The approach you took is fine, all you need to do now is to provide your own formatting for the Axis labels and ToolTips. To do this use the GetAxisLabel and GetTip events. These events allow you to take the string that is going to be displayed and change it. For example: chart1.AxisY.Style |= AxisStyle.Notify; private void chart1_GetAxisLabel(object sender, SoftwareFX.ChartFX.AxisLabelEventArgs e) { if (e.Axis == chart1.AxisY) { double value = double.Parse(e.Label); e.Label = string.Format("{0} hrs {1} minutes",(int) value, (value - (int) value)*60); } } A similar approach can be used to customize the tooltips. Note: All automatic steps, chart margins etc. will be calculated using the original labels, is you are replacing the labels with strings that are different in size you may want to have to manually set your margins and axis step. -- FP Software FX Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.