X value display wrongly

TeeChart for ActiveX, COM and ASP
Post Reply
onyx
Newbie
Newbie
Posts: 6
Joined: Fri Nov 15, 2002 12:00 am
Location: Kuala Lumpur
Contact:

X value display wrongly

Post by onyx » Tue May 27, 2008 10:11 am

Hi all,

I'm new with TeeChart. I have create a simple TeeChart where the data read from our database.

For example:

Code: Select all

<!--#include file = "../Idle.asp"-->
<!--#include File = "../../DBConnection/epmiDB.asp"-->
<!--METADATA NAME="TeeChart Pro v6 ActiveX Control" TYPE="TypeLib" UUID="{54294AC6-FA71-4C7F-B67C-6C6405DFFD48}"-->
<%
  if Request.QueryString("CreateChart")=1 Then
    Response.BinaryWrite(RunChart)
  else 
    CreatePage
  end if 
  
  Function RunChart()

    dim img
    dim Chart

    Set Chart = CreateObject("TeeChart.TChart")

    
    Chart.AddSeries(scHistogram)

    Chart.Series(0).Marks.Visible=false
    Chart.Series(0).Color=vbBlue

    Chart.Legend.Visible=false
    Chart.Aspect.View3D =false
    Chart.Axis.Bottom.Labels.Angle=0
    Chart.Height=250
    Chart.Width=400
    Chart.Panel.Gradient.Visible=true
    Chart.Panel.Gradient.StartColor=vbwhite
    Chart.Panel.Gradient.EndColor = vbwhite
    Chart.Header.Text(0)=" "
    Chart.Header.Font.Bold=True
    Chart.Axis.Bottom.Title.Font.Bold=True 
    Chart.Axis.Left.Title.Font.Bold=True 
    Chart.Axis.Left.Title.Caption="# of Patient Visits" 
    Chart.Axis.Bottom.Title.Caption="Hour"
    Chart.Axis.Left.Increment = 1


           
    Set RSt = Server.CreateObject("ADODB.RecordSet")
	SQLtemp ="select datePart(hh, timeIn) as whour, count(patientID) as billPatient from visit where LicenseNo='"&session("LNo")&"' and timeIn between '"& session("b4Start") &"' and '"& session("b4End") &"' group by datePart(hh, timeIn);"
	RSt.Open SQLtemp, epmi, 1, 1
	
	
    if RSt.RecordCount > 0 then       
      Chart.Series(0).Datasource = RSt
      Chart.Series(0).LabelsSource="whour"
      Chart.Series(0).YValues.ValueSource="billPatient"
	  
    else
      Chart.Header.Text(0)="No Record Found!"
    end if

    Rst.close
    epmi.close
    Set Rst=nothing
    Set epmi=nothing
    img=Chart.Export.asPNG.SaveToStream
    Set Chart=nothing
    RunChart=img

  End function  
%>
I have wrote this codes for web application, and it's display nicely in my PC (localhost), but when I uploaded into the server and display on website the the X value

Code: Select all

Chart.Series(0).LabelsSource="whour"
not sort in order. its display 23 15 7 22 14 21 13 20 12 19 11 18 10 17 9 16 8 . It should be 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

Hope somebody can help me.
Thanks in advance

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

Post by Narcís » Tue May 27, 2008 10:15 am

Hi onyx,

You can try setting series's XValues.Order to ascending mode before assigning their datasource, for example:

Code: Select all

TChart1.Series(0).XValues.Order = loAscending 
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

onyx
Newbie
Newbie
Posts: 6
Joined: Fri Nov 15, 2002 12:00 am
Location: Kuala Lumpur
Contact:

Post by onyx » Tue May 27, 2008 10:21 am

Hi Narcís,

Thanks for immediet reply.
I'll try it soon.

erm...is there a codes where by i can change the whour into 12 hour format rather than 24 hour format? :lol:
i'm not perfect person! there's many things i wish i didn't do, but i continue learning...

Raziedahanin Kasim
CMEwww Sdn. Bhd / ONYX Enterprise

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

Post by Narcís » Tue May 27, 2008 10:40 am

Hi onyx,

Yes, you can use this:

Code: Select all

    TChart1.Axis.Bottom.Labels.DateTimeFormat = "dd/mm/yyyy hh:mm:ss ampm"
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

onyx
Newbie
Newbie
Posts: 6
Joined: Fri Nov 15, 2002 12:00 am
Location: Kuala Lumpur
Contact:

Post by onyx » Wed May 28, 2008 10:04 am

Thank you very much Narcís... :D
it works!...


this is example from the sql query

whour (Y value) : 7 8 9 10
BillPatient (* X value): 1 6 14 5

why X value sometimes start with 1 or 2. It should start with 0
i'm not perfect person! there's many things i wish i didn't do, but i continue learning...

Raziedahanin Kasim
CMEwww Sdn. Bhd / ONYX Enterprise

Post Reply