"Your Result"

TeeChart for ActiveX, COM and ASP
Post Reply
DJ200
Newbie
Newbie
Posts: 39
Joined: Thu Feb 28, 2008 12:00 am

"Your Result"

Post by DJ200 » Sun Jun 01, 2008 6:15 pm

Hello

I have a problem that I can't seem to solve.

I have a stacked bar chart that shows a particular reagent count stacked with the total reagent count against the value obtained by the reagent. So, a typical graph would have a Y -axis called Count, and an X -axis with Grouped results. No problem there at all.

My problem comes when I want to indicate a "Your Result" on one of the stackbars. I am using a Point Series (Diamond) to illustrate where "Your Result" fits along the Result Group X-Axis, and a point (I chose the Total Count field of the recordset ) on the Y-Axis to just lift the Diamond from the baseline X-Axis. But, I can't get it to do this. I get my Diamond point..but I get lots of Diamond points, not a single "Your Value". These points also don't appear to be fitted to teh correct Group Result Stackbar either.

To clarify:
The Count/Total Count and Result Group axis render all OK, but I can't get my "Your Result" to show in one place, ie, on the appropriate "Result Group column of the X-axis, and the Count of the Y-Axis.

My graph recordset is built thus from a series of sql's:

..............
.........
....
If rsGeneric.RecordCount > 0 Then
rsGeneric.MoveFirst
Do While Not rsGeneric.EOF
Increment = 0

With NewRs
.AddNew
!Survey = rsGeneric!Survey

Increment = rsGeneric!Increment
!Increment = Increment '*The Result Group value

!Count = rsGeneric!Count '*Reagent Only Count
!Total = rsGeneric!Total '*Total Count minus specific Reagent only count

If rsResult!Your_Result = Increment Then
!Your_Result = rsResult!Your_Result
Else
!Your_Result = -100 '*Just hide it on the graph
End If

!Reagent = rsGeneric!Reagent
.Update
End With

rsGeneric.MoveNext
Loop

.....


My Graph code looks like this:

rsGeneric datasource is derived from the recordset above

If rsGeneric.State = adStateOpen Then

TChart4.Header.Text.Text = "Test"
TChart4.Axis.Bottom.Title.Caption = "Result"

TChart4.Series(0).DataSource = "" '*Clear out any old datasource
TChart4.Series(1).DataSource = "" '*Clear out any old datasource
TChart4.Series(2).DataSource = "" '*Clear out any old datasource

If rsGeneric.RecordCount > 0 Then

TChart4.Header.Text.Text = "Reagent " & rsGeneric!Reagent

With TChart4.Series(0)
.Color = vbRed
.asBar.MultiBar = mbStacked
.DataSource = rsGeneric
.YValues.ValueSource = rsGeneric.Fields(2).Name '*The Y Axis (Reagent Count)
.LabelsSource = rsGeneric.Fields(1).Name '*The X Axis (Increment)
.Marks.Visible = False '*Don't show the individual values for each pint
.ShowInLegend = False '*Don't show the Series title
End With

With TChart4.Series(1)
.Color = vbBlue
.DataSource = rsGeneric
.YValues.ValueSource = rsGeneric.Fields(3).Name '*The Y Axis (Total) '*Total Count minus Reagent Count
.LabelsSource = rsGeneric.Fields(1).Name '*The X Axis (Increment)
.Marks.Visible = False '*Don't show the individual values for each pint
.ShowInLegend = False '*Don't show the Series title
End With

TChart4.Header.Text.Text = "Reagent " & rsGeneric!Reagent


ALL WORKS FINE TO HERE

' '*Now fill in "Your Result"

With rsGeneric
Dim X As Integer
X = 0
.MoveFirst
TChart4.Header.Text.Text = "Reagent " & rsGeneric.Fields(5)
Do While Not .EOF
X = X + 1
With TChart4.Series(2)
.DataSource = rsGeneric

.YValues.ValueSource = rsGeneric.Fields(3).Name '*The Y Axis '*Total Count minus Reagent Count
' .LabelsSource = rsGeneric.Fields(4).Name '*The X Axis (Your Result)


.Marks.Visible = False '*Don't show the individual values for each pint
.ShowInLegend = False '*Don't show the Series title
rsGeneric.MoveLast

Else

End If
End With

.MoveNext
Loop
End With

Else

TChart4.Header.Text.Text = "Test"
End If

End If

It is at this last Series(2) that I can't get "Your Result" to show properly.

Can anyone suggest what I am doing wrong here please?
Thank you

David

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Jun 02, 2008 8:18 am

Hi David,

Could you please send us a simple example project we can run "as-is" to reproduce the problem here? If you want there's no need to sending us your database, you can use random/manual data.

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

DJ200
Newbie
Newbie
Posts: 39
Joined: Thu Feb 28, 2008 12:00 am

Post by DJ200 » Mon Jun 02, 2008 1:25 pm

Thanks Narcis, I have sent a zip file called BarGraph. You will have to make an ODBC to the Access 2000 test db that I have included.

Regards.

David

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Jun 04, 2008 9:53 am

Hi David,

Thanks for the example project but it's still not exactly clear to us which is the exact problem you are having. Could you please send us an image indicating the problem you are having and what you'd expect?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

DJ200
Newbie
Newbie
Posts: 39
Joined: Thu Feb 28, 2008 12:00 am

Post by DJ200 » Wed Jun 04, 2008 4:07 pm

Hello Narcis

I have sent you another zip with a jpg of what I want, a PDF of what I am getting, and a doc to explain the problem. It is really only showing the single yellow Diamond "Your Result" that is the problem.

Best regards

David

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Jun 11, 2008 11:16 am

Hi David,

Thanks for the example project. First of all, we think you shouldn't not iterate and assign the datasource several times to the series. Anyway, using code below you achieve what you requested.

Code: Select all

'       '*Now fill in "Your Result" Use a Yellow Diamond on the BarStack
    With rsGeneric
    Dim X As Integer
    X = 0
        .MoveFirst
        TChart4.Header.Text.Text = "APTT " & rsGeneric.Fields(5)
        Do While Not .EOF
            X = X + 1
            With TChart4.Series(2)
                .DataSource = rsGeneric
            
                If rsGeneric.Fields(4).Value > 0 Then
                    .AddXY rsGeneric.Fields(4).Value, rsGeneric.Fields(3).Value, "", clTeeColor
          
'                   .YValues.ValueSource = rsGeneric.Fields(3).Name     '*The Y Axis (Total)
'                   .XValues.Value(X) = rsGeneric.Fields(4).Value
                End If
                
                .Marks.Visible = False                              '*Don't show the individual values for each pint
                .ShowInLegend = True                                 '*Don't show the Series title
                rsGeneric.MoveLast
            End With

            .MoveNext
        Loop
    End With
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

DJ200
Newbie
Newbie
Posts: 39
Joined: Thu Feb 28, 2008 12:00 am

Post by DJ200 » Wed Jun 11, 2008 9:10 pm

Thanks Narcis.

Unfortunately, this still does not work. Using the code as you posted, I get the Blue bar (Total Count) and the Red Bar (Reagent Count) stacked, but no Yellow "Your Result" over the appropriate Increment value Stacked Bar. I take your point about the .DataSource, that was a mistake. However, it still will not give me the "Your Result" as shown on my sample document. Playing around with it, I get the single yellow diamond to appear, but in totally random places that bear no resemblence to the participants Increment group as listed in the Result table.

Thanks

Best regards.


David

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Jun 12, 2008 7:17 am

Hi David,

In that case you may need to check that the RecordSet returns the results you expect and assign it only once as series' DataSource.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

DJ200
Newbie
Newbie
Posts: 39
Joined: Thu Feb 28, 2008 12:00 am

Post by DJ200 » Thu Jun 12, 2008 6:35 pm

Hello Narcis, yes the recordset only contains the series data that I want, as per the example that I sent to you. I have also changed the sub to only iterate the datasource once. But is still doesn't work.

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Jun 17, 2008 1:56 pm

Hi David,

ok, I'm sorry but I'm not sure which is the result you expect. Have you tried to add the Series Data returned by the recordset manually ? This would help to know if the problem appears assigning the DataSource or if the value returned is not the expected.

Post Reply