Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Microsoft .Net & .Net Compact Framework
 QCChart2D and QCChart2D CF (VB and C#)
 How to format numeric label based on display units
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ypan

2 Posts

Posted - 04 Apr 2007 :  17:19:01  Show Profile  Reply with Quote
I have a y-axis. The value is from 500,000 to 5,000,000. Can I format the label display based on the display units?

For example, if I choose the display unit as millions, I would like the label to display from 0.5 to 5; if I choose the display unit as thousands, I would like the label to display from 500 to 5,000; and so on.

Any help is appreciated. Thanks!

quinncurtis

1164 Posts

Posted - 05 Apr 2007 :  08:39:52  Show Profile  Reply with Quote
You would have to use two coordinate systems in the same plotting area. The first coordinate system would have the max y-coordinate scaled to match your data, and that coordinate system would be referenced when you plotted the data. The second coordinate system would be scaled to reflect what range you wanted the y-axis to display. That coordinate system would be referenced when you created the y-axis. That way the values of the y-axis would be completely independent of the values of the plotted data, allowing you to establish whatever relationship that you wanted.

See QCChart2D FAQ #2 for more information about establishing multiple coordinate systems:
http://www.quinn-curtis.com/QCChart2DFAQs.htm
Go to Top of Page

quinncurtis

1164 Posts

Posted - 05 Apr 2007 :  09:08:17  Show Profile  Reply with Quote
Another, even easier method is to just scale your data ( divide by 1M, 1K, whatever..) before you create the charts dataset(s). Then just plot the data and create the axes using a single coordinate system based on the scaled data. You can use a y-axis title object to specified whether the units or in millions, thousands, or whatever.

Go to Top of Page

ypan

2 Posts

Posted - 05 Apr 2007 :  15:52:47  Show Profile  Reply with Quote
Thanks for the reply. The scaling dataset method works. The only problem is my dataset is very big, more than 10 millions points. It will take a while to scale the dataset.

I also have try to use AxisLabels.SetAxisLabelsFormat(ChartObj.BUSINESSFORMAT) method. But this method does not reduce the digits displayed, i.e., does not save space. For example, 1,000 becomes 1.000 K.Is it the intended result?

Thanks!
Go to Top of Page

quinncurtis

1164 Posts

Posted - 05 Apr 2007 :  16:36:39  Show Profile  Reply with Quote
Hopefully you have read the FAQ that discusses plotting large datasets and data compression.

The decimal precision depends on the range of data. If the range is small, relative to the absolute value of the data, then the decimal precision increases. I would guess that you have a small range, but large absolute values.

You can override the default calculation using the AxisLabels.SetAxisLabelsDecimalPos method.

For example if you are using the BUSINESSFORMAT working in thousands:

yaxislabels1.SetAxisLabelsDecimalPos(-3)

and if you are working in millions.

yaxislabels1.SetAxisLabelsDecimalPos(-6)

You can experiment with other values around those to get the result that you want.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-07 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07