Author |
Topic  |
|
bli7167
12 Posts |
Posted - 12 Apr 2006 : 17:14:39
|
I need to put a set of multi line, multi column numbers into a chart to display a stock's fundamentals, such as it's earning, sales, and EPS(Earning Per Share). We need left justfication for certain colume, right justif. for numbers, and center justi. for column titles.
What is the best way to approach this?
(1) Should I build a linear coordnate system?
(2) What is the best way to calculate the starting x position of a number in order to preserve right justification? If I tell you a specific character string, such as "23.06", and I also tell you the font I use, do you have a function to calculate how long the string would be in the underneath coordinate system? My point is, if it's possible, then the starting x position would be "x_pos_of_Right_Justify_Point - String_Length"
(3) Do you have the same function for the height for y position placement?
(4) I see for your ChartText you have xjust, yjust property. Is this used to simplify what I tried to do above? How do you decide the multiple bases(considering that there are multiple columns) where the JUSTIFY_MIN, JUSTIFY_CENTER, and JUSTIFY_MAX are based on?
Thanks.
Bing
B7167 |
|
quinncurtis
1164 Posts |
Posted - 13 Apr 2006 : 10:04:30
|
The software does not include features for advanced text positioning and formatting. That is the domain of reporting software, such as Crystal Reports.
A given text object can only have one justification for each of the x- and y-dimensions: (left or top), right (or bottom), or center. While a single text object can have multiple rows, you can't have independently justified columns within a text object.
1. Any simple linear CartesianCoordinate system will work. It is easiest to just position the text using a normalized graph coordinate system (0.0-1.0) for the entire graph area. See the ChartText usage in the FinancialExamples.OpeningScreen example.
2. We don't have the advanced text measuring routines you describe, though they are part of the overall .Net graphics architecture. When you create all of the chart objects, the graphics context (Graphics) has not been created yet. The graphics context is required to get all text sizing information. The graphics context is only available when the graph is rendered to the screen or the printer, which takes place after the graph has already been defined. So, all of the formating information needs to be stored, and then when the object is rendered, that is when you do all of the text size and positioning calculations. That's what we do, inside our libraries, with our relatively simple positioning routines.
3. Same as 2.
4. As was said earlier, you can't have independently justified columns within a text object. Your only choice is to setup each column as a separate, multi-line text object, which is either left, center or right justified.
|
 |
|
bli7167
12 Posts |
Posted - 13 Apr 2006 : 11:03:42
|
I guess since I gave you a wrong impression by calling it multi line, multi row, thus we are talking about 2 different things here.
I do not mean that these data field has to be defined as one text objects. Instead, each data item can be a separate data objects. For example, for a column with a title (center justified) which has 5 rows (all number and right justified). I can define a text object with center justification for title, and 5 different text items for each of the 5 row of the data.
My main concers is how to correlated them together. In that I mean if I position the title at certain location, how to calculate the first data row to be under it so the y direction distance between top of the title and top of the first data row to be "gap + font height in underlying coordinate system".
For x direction, say the first data row is "3.1", right justified at x axis location of 100, and if next data row is "12.87", define as another ChartText, how do I calculate the x axis location of 12.87 so it ended at the same location as 100 for right justification with the "3.1" above? This is significate since how big 12.87 is depend on what font you use.
In other word, do you have a function which allow me to place an text object not at its top left location, but at its top right location?
Thanks.
Bing
B7167 |
 |
|
quinncurtis
1164 Posts |
Posted - 13 Apr 2006 : 11:48:42
|
Sorry, but the QCChart2D software does not expose those types of text size and positioning routines that a programmer can use at the time the chart is defined. When the chart is defined by the programmer, the graphics context is not available, and the graphic context is a requirement for all text size functions. In order to do what you describe you would have to program at the lowest level of the .Net graphics API, when the graph is actually rendered to the display device, or use a software package that is designed explicitly for that type of thing. If we know in advance exactly what text/numeric format is required, we can create a class that can be used by the QCChart2D software to display that format. We have not, however, created universal chart text classes that can support any format anyone can think of.
|
 |
|
|
Topic  |
|
|
|