i have posted the tee file as well as the excel file for the sam data
in tchart , left axis maximum show above 100
where as excel shows exact 100 ..
when i am having negative values in the data , tchart axis adds the negative value ,( when you compare the graph ,you can easily understand the point)
graph used is stacked bar
advise need on handling negative values
Stack graph plotting
Hi daryl,
We've taken a look at your data at both excel's chart and teechart's chart and we consider that Teechart is fairer to original data. Because when you add a negative value, excel subtracts the negative value from one of the positives values you added but who controls from which? We consider this as data inconsistency.
For example if your values represent the percent of benefit/deficit of an operation with each company, from which company's benefit is going to be substracted the deficit from Epson?
That's why teechart accumulates positive values over 0 and negative under 0. So, if you look at your data and sum the positive values you'll see both stacked bars sum more than 100.
In any case, if you wish to have a mark indicating the result benefit, we suggest you to use an Add function.
We've taken a look at your data at both excel's chart and teechart's chart and we consider that Teechart is fairer to original data. Because when you add a negative value, excel subtracts the negative value from one of the positives values you added but who controls from which? We consider this as data inconsistency.
For example if your values represent the percent of benefit/deficit of an operation with each company, from which company's benefit is going to be substracted the deficit from Epson?
That's why teechart accumulates positive values over 0 and negative under 0. So, if you look at your data and sum the positive values you'll see both stacked bars sum more than 100.
In any case, if you wish to have a mark indicating the result benefit, we suggest you to use an Add function.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Hi Daryl,
You can do it manually by looking for the negative values and subtracting them from another positive value/s. So you have to decide from which value/s are you going to subtract the negative value and check that the positive value/s is/are greater than the negative.
In the following example we've entered the values manually to show you a simple example of how you can subtract the negative value from the following value.
You can do it manually by looking for the negative values and subtracting them from another positive value/s. So you have to decide from which value/s are you going to subtract the negative value and check that the positive value/s is/are greater than the negative.
In the following example we've entered the values manually to show you a simple example of how you can subtract the negative value from the following value.
Code: Select all
Private Sub Command1_Click()
Dim i, j As Integer
For i = 0 To TChart1.SeriesCount - 1
For j = 0 To 1
If TChart1.Series(i).YValues.Value(j) < 0 Then
If (TChart1.Series((i + 1) Mod TChart1.SeriesCount).YValues.Value(j) + TChart1.Series(i).YValues.Value(j)) > 0 Then
TChart1.Series((i + 1) Mod TChart1.SeriesCount).YValues.Value(j) = TChart1.Series((i + 1) Mod TChart1.SeriesCount).YValues.Value(j) + TChart1.Series(i).YValues.Value(j)
TChart1.Series(i).YValues.Value(j) = 0
End If
End If
Next j
Next i
End Sub
Private Sub Form_Load()
Dim i As Integer
TChart1.Aspect.View3D = False
For i = 0 To 6
TChart1.AddSeries scBar
TChart1.Series(i).Marks.Visible = False
Next i
TChart1.Series(0).asBar.MultiBar = mbStacked
TChart1.Series(0).Add -10, "", vbRed
TChart1.Series(0).Add 25, "", vbRed
TChart1.Series(1).Add 30, "", vbBlue
TChart1.Series(1).Add -10, "", vbBlue
TChart1.Series(2).Add 25, "", vbGreen
TChart1.Series(2).Add 20, "", vbGreen
TChart1.Series(3).Add -10, "", vbYellow
TChart1.Series(3).Add 25, "", vbYellow
TChart1.Series(4).Add 25, "", vbGrayText
TChart1.Series(4).Add -5, "", vbGrayText
TChart1.Series(5).Add 20, "", vbWhite
TChart1.Series(5).Add 25, "", vbWhite
TChart1.Series(6).Add 20, "", vbBlack
TChart1.Series(6).Add 20, "", vbBlack
Caption = Str$(TChart1.Series(0).YValues.Value(0))
End Sub
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |