We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Charts w/ bytes

Hello,

I am making a chart that plots number of Bytes vs time. Is there any way that I can make chart handle this properly.

I.E. if the data is over 1024 Bytes use KB, if it is over 1024 KB use MB, ...

I am in a scenario where some cases, only bytes will be used, where other cases, GB will be used.

Thanks


1 Reply

MA Manohari Syncfusion Team September 14, 2008 12:43 PM UTC

Hi Michael,

We regret very much for the delayed response. If your intention is the change the Axis labels to display the correct unit depending on the Y Values, It is possible by customizing the Y axis Labels using the formatLabel event. Kindly refer to the sample code below.

Sample code:

this.chartControl1.PrimaryYAxis.FormatLabel += new ChartFormatAxisLabelEventHandler(PrimaryYAxis_FormatLabel);
}

void PrimaryYAxis_FormatLabel(object sender, ChartFormatAxisLabelEventArgs e)
{
double index = e.Value;

if (index > (1024 * 1024))
{
e.Label = string.Format("{0:n2} Mb",(index / (1024 * 1024)));
} else if (index > 1024)
{
e.Label = string.Format("{0:n2} Kb", (index / 1024));
}
else
{
e.Label = index + " b";
}

I have attached the sample that illustrates the same in this link below.

http://websamples.syncfusion.com/samples/Chart.Windows/F76349/Sample1.htm

Kindly let us know if this meets your requirement. I hope I have not misunderstood your requirement. If I have, could you please provide more information on your requirement? Thanks for your patience.

Regards,
Manohari.R


Loader.
Live Chat Icon For mobile
Up arrow icon