Page 1 of 1

MaksTip

Posted: Tue Sep 22, 2009 2:26 pm
by 9532689
Hi,

I think this is not possible but I ask the question anyway. I have two series stacked. I created the tcMarksTip tool and the marks on the top are visible. I would like to display two diffetent values on the each marks (on tcMarksTip tool = value, on marks = total of two series). Is it possible to do something like that ?


Thank you
tcmarkstip.JPG
tcmarkstip.JPG (16.42 KiB) Viewed 6904 times

Re: MaksTip

Posted: Tue Sep 22, 2009 3:36 pm
by yeray
Hi Rousseau,

Yes, if I understand well this example is doing what you are trying to achieve:

Code: Select all

Private Sub Form_Load()
  TChart1.AddSeries scBar
  TChart1.AddSeries scBar
  
  TChart1.Series(0).Add 3, "", clTeeColor
  TChart1.Series(0).Add 5, "", clTeeColor
  TChart1.Series(0).Marks.Visible = False
  
  TChart1.Series(1).Add 4, "", clTeeColor
  TChart1.Series(1).Add 8, "", clTeeColor
  
  TChart1.Series(0).asBar.MultiBar = mbStacked
  
  TChart1.Tools.Add tcMarksTip
  
  RecalcTotals
End Sub

Private Sub RecalcTotals()
  Dim SeriesIndex, ValueIndex As Integer
  Dim total As Double
  
  For ValueIndex = 0 To TChart1.Series(0).Count - 1
    total = 0
    For SeriesIndex = 0 To TChart1.SeriesCount - 1
      total = total + TChart1.Series(SeriesIndex).YValues.Value(ValueIndex)
    Next SeriesIndex
    TChart1.Series(TChart1.SeriesCount - 1).PointLabel(ValueIndex) = Str$(total)
  Next ValueIndex
End Sub

Re: MaksTip

Posted: Tue Sep 22, 2009 5:57 pm
by 9532689
Hi Yeray,

It's not exactly what I'm trying to do.

There are some screenshot.

Before to call RecalcTotals.
tcmarkstip1.JPG
tcmarkstip1.JPG (32.37 KiB) Viewed 6884 times
After to call RecalcTotals.
tcmarkstip2.JPG
tcmarkstip2.JPG (36.4 KiB) Viewed 6897 times


The values display with the tcMarksTip change for the total. I try to display each values ( Value of serie(0), Value of serie(1), total of two series).

Re: MaksTip

Posted: Wed Sep 23, 2009 8:21 am
by yeray
Hi Rousseau,

Excuse me, I forgot one line at Form_Load method, after adding the MarksTip tool:

Code: Select all

TChart1.Tools.Items(0).asMarksTip.Style = smsValue

Re: MaksTip

Posted: Wed Sep 23, 2009 1:09 pm
by 9532689
thanks, that's work exactly as I wanted. :D