OWC

Hi all..can anyone tell me how I can add data label to my graph please? below is the graph I have so far..I want the value of the graph to be labelled beside the marker in the graph..Please help?

Dim ObjChart
    Dim ChaCon
    Dim ObjCharts
    Dim SerCol
      Dim objAxis
      Dim objFont
    Set ObjChart = Server.CreateObject("OWC.Chart")
    Set ChaCon = ObjChart.Constants
    Set ObjCharts = ObjChart.Charts.Add
    'adding my line
      Set SerCol = ObjCharts.SeriesCollection.Add
    Set SerCol1 = ObjCharts.SeriesCollection.Add
    'ObjCharts.Type = ChaCon.chChartTypeColumnClustered
      ObjCharts.Type = ChaCon.chChartTypeLine
                'this is in purple line
                SerCol.Caption = "Fuel Oil Cons"
                SerCol.SetData ChaCon.chDimCategories, ChaCon.chDataLiteral, Val
                SerCol.SetData ChaCon.chDimValues, ChaCon.chDataLiteral, Line1Val
                  SerCol.Type = ChaCon.chChartTypeLineMarkers
                '-------------------------------
                'this is my line in the graph
                SerCol1.Caption = "Lub Oil Cons"
                SerCol1.SetData ChaCon.chDimCategories, ChaCon.chDataLiteral, Val
                SerCol1.SetData ChaCon.chDimValues, ChaCon.chDataLiteral, LineVal
                  ObjCharts.seriescollection.LabelShowActualValue = true

                  'ObjCharts.SeriesCollection.DataLabelsCollection(0).add
                'change      from the default bar graph To a line
                SerCol1.Type = ChaCon.chChartTypeLineMarkers
                '----------------------------
                  
    'Title of graph
    ObjChart.HasChartSpaceTitle=True
      'Legend in the graph
    ObjChart.ChartSpaceTitle.Caption = "FO/LO CONSP / HR"
      ' Set a variable to the Value (X) axis.
      Set axCategoryAxis = ObjChart.Charts(0).Axes(0)
    ' Set a variable to the Value (Y) axis.
    Set axValueAxis = ObjChart.Charts(0).Axes(1)

    ' The following two lines of code enable, and then
    ' set the title for the category axis.
    axCategoryAxis.HasTitle = True
    axCategoryAxis.Title.Caption = "LITRES / TONNES"
   
    ' The following three lines of code set the font
    ' for the values displayed on the category axis.
    axCategoryAxis.Font = "Arial"
    axCategoryAxis.Font.Size = 8
    axCategoryAxis.Font.Bold = True
YannieAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

babuno5Commented:
we can you explain in detail as i have not understood exactly what you want
babuno5Commented:
are u looking for something like this
try this out and let me know
 <%
     'label the months.
    dim Val(4)
    Val(1) = 10
    Val(2) = 11
    Val(3) = 12
    Val(4) = 13
    dim Line1Val(4)
    Line1Val(1) = 10
    Line1Val(2) = 20
    Line1Val(3) = 30
    Line1Val(4) = 40
    dim Line1Val1(4)
    Line1Val1(1) = 40
    Line1Val1(2) = 30
    Line1Val1(3) = 20
    Line1Val1(4) = 10
    'Val(5) = 4
   ' Val(6) = 6
    'Val(7) = 7
    'Val(8) = 8
     'Val(9) = 9
     'Val(10) = 10
     'Val(11) = 11
     'Val(12) = 12
    Dim ObjChart
    Dim ChaCon
    Dim ObjCharts
    Dim SerCol
     Dim objAxis
     Dim objFont
    Set ObjChart = Server.CreateObject("OWC.Chart")
    Set ChaCon = ObjChart.Constants
    Set ObjCharts = ObjChart.Charts.Add
    'adding my line
     Set SerCol = ObjCharts.SeriesCollection.Add
   
    'ObjCharts.Type = ChaCon.chChartTypeColumnClustered
     ObjCharts.Type = ChaCon.chChartTypeLine
              'this is in purple line
              ObjChart.Charts(0).SeriesCollection(0).Caption = "Fuel Oil Cons"
              ObjChart.Charts(0).SeriesCollection(0).SetData ChaCon.chDimCategories, ChaCon.chDataLiteral, Val
              ObjChart.Charts(0).SeriesCollection(0).SetData ChaCon.chDimValues, ChaCon.chDataLiteral, Line1Val
               SerCol.Type = ChaCon.chChartTypeLineMarkers
Set SerCol1 = ObjCharts.SeriesCollection.Add              
              '-------------------------------
              'this is my line in the graph
              ObjChart.Charts(0).SeriesCollection(1).Caption = "Lub Oil Cons"
              ObjChart.Charts(0).SeriesCollection(1).SetData ChaCon.chDimCategories, ChaCon.chDataLiteral, Val
              ObjChart.Charts(0).SeriesCollection(1).SetData ChaCon.chDimValues, ChaCon.chDataLiteral, Line1Val1
              'change     from the default bar graph To a line
                            
              ObjChart.Charts(0).SeriesCollection(1).Type = ChaCon.chChartTypeLineMarkers
              '----------------------------
         Set SeriesLabels = ObjChart.Charts(0).SeriesCollection(0).DataLabelsCollection.Add

        ' Set the number format of the data labels.
        SeriesLabels.NumberFormat = "00.00"              

Set SeriesLabels1 = ObjChart.Charts(0).SeriesCollection(1).DataLabelsCollection.Add

        ' Set the number format of the data labels.
        SeriesLabels1.NumberFormat = "00.00"        
    'Title of graph
    ObjChart.HasChartSpaceTitle=True
     'Legend in the graph
    ObjChart.ChartSpaceTitle.Caption = "FO/LO CONS / HR"
     
     
     
    Set axCategoryAxis = ObjChart.Charts(0).Axes(0)
   
    ' Set a variable to the Value (Y) axis.
    Set axValueAxis = ObjChart.Charts(0).Axes(1)

    ' The following two lines of code enable, and then
    ' set the title for the category axis.
    axCategoryAxis.HasTitle = True
    axCategoryAxis.Title.Caption = "Months"
   
    ' The following three lines of code set the font
    ' for the values displayed on the category axis.
    axCategoryAxis.Font = "Arial"
    axCategoryAxis.Font.Size = 8
    axCategoryAxis.Font.Bold = True

    ' The following two lines of code enable, and then
    ' set the title for the value axis.
    axValueAxis.HasTitle = True
    axValueAxis.Title.Caption = "Litres"    'Put your Cation for Y-Axis

    ObjChart.HasChartSpaceLegend = True
    ObjChart.ChartSpaceLegend.Position = ChaCon.chLegendPositionRight
     'Call CleanUpGIF("\\oceanflow\iat$\lubOilConsump\reports\")
    ImagePath=server.mappath("oilgraph.gif")
   
    ObjChart.ExportPicture ImagePath,"gif", 700, 400
    Set ChaCon = nothing
    Set ObjCharts = nothing
    Set ObjChart = nothing %>
     
    <Img src="oilgraph.gif" width="700" height="400">
babuno5Commented:
a little modification

 <%
     'label the months.
    dim Val(4)
    Val(1) = 10
    Val(2) = 11
    Val(3) = 12
    Val(4) = 13
    dim Line1Val(4)
    Line1Val(1) = 10
    Line1Val(2) = 20
    Line1Val(3) = 30
    Line1Val(4) = 40
    dim Line1Val1(4)
    Line1Val1(1) = 40
    Line1Val1(2) = 30
    Line1Val1(3) = 20
    Line1Val1(4) = 10
    'Val(5) = 4
   ' Val(6) = 6
    'Val(7) = 7
    'Val(8) = 8
     'Val(9) = 9
     'Val(10) = 10
     'Val(11) = 11
     'Val(12) = 12
    Dim ObjChart
    Dim ChaCon
    Dim ObjCharts
    Dim SerCol
    Dim objAxis
    Dim objFont
    Set ObjChart = Server.CreateObject("OWC.Chart")
    Set ChaCon = ObjChart.Constants
    Set ObjCharts = ObjChart.Charts.Add
    'adding my line
    Set SerCol = ObjCharts.SeriesCollection.Add
      Set SerCol1 = ObjCharts.SeriesCollection.Add    
   
    'ObjCharts.Type = ChaCon.chChartTypeColumnClustered
     ObjCharts.Type = ChaCon.chChartTypeLine
              'this is in purple line
              SerCol.Caption = "Fuel Oil Cons"
              SerCol.SetData ChaCon.chDimCategories, ChaCon.chDataLiteral, Val
              SerCol.SetData ChaCon.chDimValues, ChaCon.chDataLiteral, Line1Val
               SerCol.Type = ChaCon.chChartTypeLineMarkers
               
              '-------------------------------
              'this is my line in the graph
              SerCol1.Caption = "Lub Oil Cons"
              SerCol1.SetData ChaCon.chDimCategories, ChaCon.chDataLiteral, Val
              SerCol1.SetData ChaCon.chDimValues, ChaCon.chDataLiteral, Line1Val1
              'change     from the default bar graph To a line
                            
              SerCol1.Type = ChaCon.chChartTypeLineMarkers
              '----------------------------
         Set SeriesLabels = ObjChart.Charts(0).SeriesCollection(0).DataLabelsCollection.Add

        ' Set the number format of the data labels.
        SeriesLabels.NumberFormat = "00.00"              

Set SeriesLabels1 = ObjChart.Charts(0).SeriesCollection(1).DataLabelsCollection.Add

        ' Set the number format of the data labels.
        SeriesLabels1.NumberFormat = "00.00"        
    'Title of graph
    ObjChart.HasChartSpaceTitle=True
     'Legend in the graph
    ObjChart.ChartSpaceTitle.Caption = "FO/LO CONS / HR"
     
     
     
    Set axCategoryAxis = ObjChart.Charts(0).Axes(0)
   
    ' Set a variable to the Value (Y) axis.
    Set axValueAxis = ObjChart.Charts(0).Axes(1)

    ' The following two lines of code enable, and then
    ' set the title for the category axis.
    axCategoryAxis.HasTitle = True
    axCategoryAxis.Title.Caption = "Months"
   
    ' The following three lines of code set the font
    ' for the values displayed on the category axis.
    axCategoryAxis.Font = "Arial"
    axCategoryAxis.Font.Size = 8
    axCategoryAxis.Font.Bold = True

    ' The following two lines of code enable, and then
    ' set the title for the value axis.
    axValueAxis.HasTitle = True
    axValueAxis.Title.Caption = "Litres"    'Put your Cation for Y-Axis

    ObjChart.HasChartSpaceLegend = True
    ObjChart.ChartSpaceLegend.Position = ChaCon.chLegendPositionRight
     'Call CleanUpGIF("\\oceanflow\iat$\lubOilConsump\reports\")
    ImagePath=server.mappath("oilgraph.gif")
   
    ObjChart.ExportPicture ImagePath,"gif", 700, 400
    Set ChaCon = nothing
    Set ObjCharts = nothing
    Set ObjChart = nothing %>
     
    <Img src="oilgraph.gif" width="700" height="400">

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
YannieAuthor Commented:
yeah u got wat i wanted! Thank you very much!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.