Page 1 of 1

Can I have Marks text display something other than X Labels?

Posted: Tue Dec 05, 2006 10:05 pm
by 9082767
Hello,

I'm trying to create my first bar graph with the TeeChart tool. I'm 99% finished, but am having some issues with a couple of oustanding issues. One is, how do I change the text in the Marks at the top of each bar to be something other than a repeat of the X Label values? Ideally, I'd like to make it the value from a third field in the dataset I'm retrieving. I've found a way to disable to marks for now:

With Chart1.Series(0)
.Color = vbGreen
.DataSource = rsGraph
.YValues.ValueSource = "audit_score"
.LabelsSource = "dc_name"
.Marks.Visible = false
End With

Posted: Thu Dec 07, 2006 10:54 am
by Pep
Hi Jimmy,
the Mark text can be customized in the OnGetSeriesMark event, you can use similar code to the following :

Code: Select all

Private Sub TChart1_OnGetSeriesMark(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, MarkText As String)
If ValueIndex > 3 Then
    MarkText = ""
Else
  MarkText = "Cust " & MarkText
End If
End Sub

Posted: Thu Dec 14, 2006 4:59 pm
by 9082767
Thanks for the response, but the problem I'm having is that I don't know how to apply your example to vbscript -- it's a syntax thing. I've tried reading through the examples, and everything I'm seeing is very generic.

I think I would need to apply it to this area of my vbscript:

With Chart1.Series(0)
.Color = vbGreen
.DataSource = rsGraph
.YValues.ValueSource = "audit_score"
.LabelsSource = "dc_name"
.Marks.Style = 5
.Marks.Visible = true
End With

As you can see, my datasource is rsGraph -- which is basically pulling back 3 fields of data from SQL Server. One of the fields, audit_score, is being used to supply the Y Axis values. A second field, dc_name, is being used to supply the X Axis values. I'd like to use the third field, audit_date, to be my custom Mark text value.

I've been playing around and discovered how to make the marks visible or invisible, and also how to change the value to be something like either a combination of the x value, y value, both values, etc. But I cannot figure out how to place a custom value -- specifically the third database field, in for the Mark.

Please, Please help!!

Posted: Fri Dec 15, 2006 8:31 am
by narcis
Hi JimmyG,

Please read Tutorial 8 - ADO Database access, this tutorials shows how to do this programmatically. You'll the tutorials at TeeChart's program group.