Hi. I'm using TeeChart 6.
In my app, I've got a bunch of records with values. For sake of example, let's say there are 5 records, with labels and values like this:
"First", 1
"Second", 2
"Third", 3
"Fourth", 4
"Fifth", 5
I'm generating an HTML page which contains a chart of the first 3 records, along with a table showing all 5 of the records.
The problem is that the chart only knows about the first 3 records, so its percentage calculations are off. It only sees a total of 6 for the entire series of 3 values (ie, 1+2+3=6), but the true total for my entire data set is 15 (ie, 1+2+3+4+5=15). The chart shows the percentages for the (first three) data points as 16.7% (ie, 1/6), 33.3% (ie, 2/6), and 50% (ie, 3/6). But the actual percentage points that I'd like to show (so that they match the table) are 6.7% (1/15), 13.3% (2/15), and 20% (3/15).
Of course, in my actual application is number of records is usually well over 50 (and could be in the hundreds), and the number of data points charted is usually 10 or 25. So simply adding all data points to the chart is not a solution. Also, I'd like to avoid adding one more data point for this "other" value (because I'm assuming that it would be visible and will screw up the chart for my purposes).
Instead, is it possible to define an "extra" or "other" value for a series, which is not charted? In my example above, I would set the series "other" value to 9 (ie, 4+5=9) so as to account for the records not being charted. Then the series would know that the total is actually 15 and thus the percentages would be shown correctly.
Is this possible? I've looked around for such a property but can't seem to find one. Or, is there another solution?
Thanks in advance!
Ken
Can I have a hidden "other" value to affect percen
-
- Newbie
- Posts: 2
- Joined: Fri May 14, 2004 4:00 am
- Location: San Francisco Bay Area
- Contact:
Hi Ken,
how about using the AddNullXY method ? Similar code like the following :
how about using the AddNullXY method ? Similar code like the following :
Code: Select all
Private Sub Form_Load()
With TChart1
.AddSeries scBar
.Series(0).AddXY 0, 1, "First", clTeeColor
.Series(0).AddXY 1, 2, "Second", clTeeColor
.Series(0).AddXY 2, 3, "Third", clTeeColor
.Series(0).Marks.Style = smsPercent
.Series(0).Marks.Visible = True
.Series(0).AddNullXY 2, 9, "NoCount"
End With
End Sub
Private Sub TChart1_OnGetLegendText(ByVal LegendStyle As Long, ByVal ValueIndex As Long, LegendText As String)
If ValueIndex = 3 Then
LegendText = ""
End If
End Sub
Pep Jorge
http://support.steema.com
http://support.steema.com
-
- Newbie
- Posts: 2
- Joined: Fri May 14, 2004 4:00 am
- Location: San Francisco Bay Area
- Contact:
I'll give it a try
Thanks. I'll give it a try, although it'll take a little while until I can get back to this issue.
BTW, your code looks like it uses a different AddNullXY than the docs describe. In the docs that ship w/ the product (v6), the function prototype is:
function AddNullXY(X, Y: Double; Const ALabel: WideString): Integer;
BTW, your code looks like it uses a different AddNullXY than the docs describe. In the docs that ship w/ the product (v6), the function prototype is:
function AddNullXY(X, Y: Double; Const ALabel: WideString): Integer;
Hi,
yes, it's the same as the one I used :
.Series(0).AddNullXY (2, 9, "NoCount")
yes, it's the same as the one I used :
.Series(0).AddNullXY (2, 9, "NoCount")
Pep Jorge
http://support.steema.com
http://support.steema.com