Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New Coder
    Join Date
    Aug 2005
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Pls help on Coding in OWC Chart

    Hi,
    I do have a line chart in asp page, I would like to have the line to be show with marker (not all line only two line nedd marker). How can I do that?
    is it a way or possible to show a point in bold or change to others color or become e more special when the data is below or greater than certain value? as what I show on the attach. the last point is oou of the LCL, can I change the marker to others color ?
    pls help Tks.

    My chart:-
    http://ccc.1asphost.com/pcs168/85266.890.6528742.gif
    Below are my code:-
    Code:
    <%tWidth = 1000
    tHeight = 400
    'all code below belongs to the chart code/////////////////////////////////////////////////////////////////////////////////////////////
    'all needed variables
       Dim aryX
       Dim aryY
       Dim objChart
       Dim objCharts
       Dim objConstants
       Dim strFileName
    'the sub that builds the chart
    Sub AddChart(objCharts, objConstants, aryData, aryDescription, intChartType, XCaption, YCaption)
          Dim objChart
          Set objChart = objCharts.Charts.Add
          With objChart
             .Type = intChartType
    		 .PlotArea.Interior.color = rgb(255,255,255)
    		 .border.color = RGB(255,255,255)
             .interior.color = RGB(240,240,240)        
    		 If Not Isnull(XCaption) Then
    		 .Axes(0).HasTitle = True
    		 .Axes(0).Title.Caption = XCaption
    		 end if
    		 .Axes(1).MajorGridlines.Line.Color = rgb(192,192,192)
    		 If Not Isnull(YCaption) Then
    		 .Axes(1).HasTitle = True
    		 .Axes(1).Title.Caption = YCaption
    		 .Axes(1).Title.Font.Name = "Arial"
    		 .Axes(1).Title.Font.Size = 10 
    		 end if
             .SetData objConstants.chDimCategories, objConstants.chDataLiteral, aryDescription
             .SeriesCollection(0).SetData objConstants.chDimValues, objConstants.chDataLiteral, aryData
    		 .SeriesCollection(0).Interior.Color = rgb(13,86,146)
    		 '.SeriesCollection(0).Border.Color = rgb(13,86,146)
    		 .SeriesCollection(0).DataLabelsCollection.Add
    		 
    		 .SeriesCollection.Add(1)  'the second data set
    		 .SeriesCollection(1).SetData objConstants.chDimValues, objConstants.chDataLiteral, aryY2
    		 .SeriesCollection(1).Interior.Color = rgb(240,0,0)
    		 if instr(tType,"Line") > 0 then
    		 '.SeriesCollection(1).Line.Color = rgb(240,0,0)
    		 .SeriesCollection(1).Line.Witdh = 10
    		 else
    		 '.SeriesCollection(1).Border.Color = rgb(240,0,0)
    		 .SeriesCollection(1).DataLabelsCollection.Add
    		 end if
    		 
    		 .SeriesCollection.Add(2)  'the 3rd data set
    		 .SeriesCollection(2).SetData objConstants.chDimValues, objConstants.chDataLiteral, aryY3
    		 .SeriesCollection(2).Interior.Color = "Red"
    		 'if instr(tType,"Line") > 0 then
    		 .SeriesCollection(2).Line.Color = "Red"
    		 'else
    		 '.SeriesCollection(2).Border.Color = rgb(0,228,0)
    		 'end if
    		 
    		 .SeriesCollection.Add(3)  'the 4th data set
    		 .SeriesCollection(3).SetData objConstants.chDimValues, objConstants.chDataLiteral, aryY4
    		 .SeriesCollection(3).Interior.Color = "Red"
    		 'if instr(tType,"Line") > 0 then
    		 .SeriesCollection(3).Line.Color = "Red"
    		 'else
    		 '.SeriesCollection(3).Border.Color = rgb(192,192,192)
    		 'end if
    		 
    		 .SeriesCollection.Add(4)  'the 5th data set
    		 .SeriesCollection(4).SetData objConstants.chDimValues, objConstants.chDataLiteral, aryY5
    		 .SeriesCollection(4).Interior.Color = "Red"
    		 'if instr(tType,"Line") > 0 then
    		 .SeriesCollection(4).Line.Color = "Red"
    		 'else
    		 '.SeriesCollection(4).Border.Color = rgb(192,192,192)
    		 'end if
    
    		 .SeriesCollection.Add(5)  'the 6th data set
    		 .SeriesCollection(5).SetData objConstants.chDimValues, objConstants.chDataLiteral, aryY6
    		 .SeriesCollection(5).Interior.Color = "Red"
    		 'if instr(tType,"Line") > 0 then
    		 .SeriesCollection(5).Line.Color = "Red"
    		 'else
    		 '.SeriesCollection(5).Border.Color = rgb(248,248,248)
    		 'end if
    
    		 
    		End With
          Set objChart = Nothing      
    End Sub
    'set the data arrays   X and Y
    'go to the  rs for this car and get 12 months, from last month, and format data
    
    dim aryX1(100), aryA(100), aryB(100), aryC(100)
    SET RS=CreateObject("ADODB.Recordset") 'create a recordset
    sql="select top 10 Avg1, Range1, Filename from tblFiles where mcno = 2 order by workweek Desc"
    'response.write sql
    'response.end
    RS.Open sql,conn,1,3
    t = 0
    do until rs.eof
    t = t + 1
    'response.write t & " <br />"
    aryX1(t) = rs("Filename")
    aryA(t) = rs("Avg1")
    aryB(t) = rs("Range1")
    aryC(t) = rs("Range1")
    rs.movenext
    loop
    'response.end
    
    'now each array has it's values, move them into the chart arrays:
    aryX =  Array(aryX1(10),aryX1(9),aryX1(8),aryX1(7),aryX1(6),aryX1(5),aryX1(4),aryX1(3),aryX1(2),aryX1(1))'Xvalues
    aryY1 = Array(aryA(10),aryA(9),aryA(8),aryA(7),aryA(6),aryA(5),aryA(4),aryA(3),aryA(2),aryA(1))
    aryY2 = Array(aryB(10),aryB(9),aryB(8),aryB(7),aryB(6),aryB(5),aryB(4),aryB(3),aryB(2),aryB(1))
    'aryY3 = Array(aryC(1),aryC(2),aryC(3),aryC(4),aryC(5))'...aryC(10))
    
    'aryY1 = Array(460,520,650,580)  'Y Values
    'aryY2 = Array(390,390,390,390,390,390,390,390,390,390)  'Y Values
    aryY3 = Array(680,680,680,680,680,680,680,680,680,680)  'Y Values
    aryY4 = Array(370,370,370,370,370,370,370,370,370,370)  'Y Values
    aryY5 = Array(46,46,46,46,46,46,46,46,46,46)  'Y Values
    aryY6 = Array(240,240,240,240,240,240,240,240,240,240)  'Y Values
    'initialize owc
       Set objCharts = Createobject("OWC10.Chartspace")
       Set objConstants = objCharts.Constants    
    'layout options
    objCharts.HasChartSpaceTitle = False
       XName = ""
       YName = "Range                           Thickness"
       Call AddChart(objCharts, objConstants, aryY1, aryX, objConstants.chChartTypeLine, XName, YName)  'build chart
       'Call AddChart(objCharts, objConstants, aryY1, aryX, objConstants.chChartTypeSmoothLine, XName, YName)
          
    'export to file
       Randomize 
    	strFileName =  Timer & Rnd & ".gif" 'make a long random filename for the gif that will hold the chart
       Call objCharts.ExportPicture(Server.MapPath(strFileName), "gif", tWidth, tHeight)
       Set objCharts = Nothing
       Set objConstants = Nothing%>
    
    
    <body>
    Last edited by cs168; 04-14-2006 at 06:01 PM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •