AllExperts > Experts 
Search      

Active Server Pages Programming (ASP)

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Active Server Pages Programming (ASP) Answers
Question Library

Ask a question about Active Server Pages Programming (ASP)
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Srini Nagarajan
Expertise
I can answer any kind of questions in ASP.NET, C#, VB.NET, SharePoint 2007, ASP, Coldfusion, Powerbuilder 7.00 / 8.00, JAVA servlets, MS SQL 2000 / MSSQL7, Sybase

Experience
Contact me if you need any custom development on ASP.NET, ASP, SharePoint 2007, Coldfusion, Powerbuilder.
 
   

You are here:  Experts > Computing/Technology > Business Software > Active Server Pages Programming (ASP) > graph

Topic: Active Server Pages Programming (ASP)



Expert: Srini Nagarajan
Date: 10/18/2005
Subject: graph

Question
sorry but i don quiet understand  that...
u mean in the for loop i can fix it?well... my question was...
hmm.. ok.. is it meaning that i should replace the
if chartValuesArr(i) < 500
to
chartValuesArr(i) =0
for chartValuesArr(i)=0 to chartValuesArr(i)=50
blablabla

meaning tis?
thank you









-------------------------
Followup To
Question -
yupe... thanks for the advice/... it is the conversion thg.. and i already convert both to double...
by the way...from the code earlier.. is it possible to make it all the y axis scale being fixed?
i mean... regardless of what value... i will set it the highest point of y axis will be 50 and the scale... will be 1cm=5 unit.....
so regardless of what value and limits... will still will give us starting from 0, 5 10,15,20,25,30,35,40,45,50 value in the y axis...
can v fix and do this?
thank you









-------------------------
Followup To
Question -
hi sorri for replying late... now... i wont use a fiz value for the limit.. instead of using 500 i will use... a value that i query string it from previous page to here so all i nid to do is just replace that 500 to textbox1.text right?

If chartValuesArr.Length <= 50 Then
        For i = 0 To chartValuesArr.Length - 1
           if chartValuesArr(i) < textbox1.text then
             chartValuesStr += chartValuesArr(i) + ","
             chartCategoriesStr += chartCategoriesArr(i)
+ ","
            end if
        Next
     Else




but.. hmm.. stg is wrong here... it still show all the data how am i going to fix this..? thank...s










-------------------------
Followup To
Question -
hi.. i have this sample coding and now i would like to limit my y axis..

a brief of the programme.. i use the data in my datagrid to use it as my data to plot the graph... but now i would like to limit my y axis so that when the data inside my data grid exceed (let says) 500, the point will not be ploted out so how can i do this? th coding looks like this... or if you nid more infor on the coding.. do email me at jasonlimwk@gmail.com




Private Sub btnGraph_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGraph.Click
       imgGraph.Visible = True
       btnPrev.Visible = False
       lblMemo.Text = ""
       memo = 0
       Dim oChartSpace As OWC11.ChartSpaceClass = New OWC11.ChartSpaceClass
       Dim chartType As OWC11.ChartChartTypeEnum
       Dim chartValuesArr As String() = TextBox1.Text.Split(",")
       Dim chartCategoriesArr As String() = TextBox2.Text.Split(",")
       Dim i As Integer
       If chartValuesArr.Length <= 50 Then
           For i = 0 To chartValuesArr.Length - 1
               chartValuesStr += chartValuesArr(i) + ","
               chartCategoriesStr += chartCategoriesArr(i) + ","
           Next
       Else
           btnNext.Visible = True
           For i = 0 To 50
               chartValuesStr += chartValuesArr(i) + ","
               chartCategoriesStr += chartCategoriesArr(i) + ","
           Next
       End If

       chartValuesStr = chartValuesStr.Substring(0, chartValuesStr.Length - 1)
       chartCategoriesStr = chartCategoriesStr.Substring(0, chartCategoriesStr.Length - 1)

       '--------------------------------------------------------------
       ' Try using different chart types just for fun
       '-------------------------------------------------------------
       'chartType = ChartChartTypeEnum.chChartTypeArea
       'chartType = ChartChartTypeEnum.chChartTypeArea3D
       'chartType = ChartChartTypeEnum.chChartTypeBarClustered
       'chartType = ChartChartTypeEnum.chChartTypeBar3D
       'chartType = ChartChartTypeEnum.chChartTypeColumnClustered
       'chartType = ChartChartTypeEnum.chChartTypeColumn3D
       'chartType = ChartChartTypeEnum.chChartTypeDoughnut
       'chartType = ChartChartTypeEnum.chChartTypeLineStacked
       'chartType = ChartChartTypeEnum.chChartTypeLine3D
       chartType = OWC11.ChartChartTypeEnum.chChartTypeLineMarkers
       'chartType = ChartChartTypeEnum.chChartTypePie
       'chartType = ChartChartTypeEnum.chChartTypePie3D
       'chartType = ChartChartTypeEnum.chChartTypeRadarSmoothLine
       'chartType = ChartChartTypeEnum.chChartTypeSmoothLine

       '------------------------------------------------------------------------
       ' Give pie and doughnut charts a legend on the bottom. For the rest of
       ' them let the control figure it out on its own.
       '------------------------------------------------------------------------
       'chartType = OWC11.ChartChartTypeEnum.chChartTypeColumn3D

       'If chartType = OWC11.ChartChartTypeEnum.chChartTypePie Or _
       '   chartType = OWC11.ChartChartTypeEnum.chChartTypePie3D Or _
       '   chartType = OWC11.ChartChartTypeEnum.chChartTypeDoughnut Then

       '    oChartSpace.HasChartSpaceLegend = True
       '    oChartSpace.ChartSpaceLegend.Position = OWC11.ChartLegendPositionEnum.chLegendPositionBottom

       'End If

       oChartSpace.Border.Color = "blue"
       oChartSpace.Charts.Add(0)
       oChartSpace.Charts(0).HasTitle = True
       oChartSpace.Charts(0).Type = chartType

       oChartSpace.Charts(0).Title.Caption = "Cycletime vs Datapoints"
       oChartSpace.Charts(0).Title.Font.Bold = True

       oChartSpace.Charts(0).SeriesCollection.Add(0)
       oChartSpace.Charts(0).SeriesCollection(0).DataLabelsCollection.Add()


       '------------------------------------------------------------------------
       'If you Then 're charting a pie or a variation thereof percentages make a lot
       ' more sense than values...
       '------------------------------------------------------------------------
       'If chartType = OWC11.ChartChartTypeEnum.chChartTypePie Or _
       '   chartType = OWC11.ChartChartTypeEnum.chChartTypePie3D Or _
       '   chartType = OWC11.ChartChartTypeEnum.chChartTypeDoughnut Then

       '    oChartSpace.Charts(0).SeriesCollection(0).DataLabelsCollection(0).HasPercentage = True
       '    oChartSpace.Charts(0).SeriesCollection(0).DataLabelsCollection(0).HasValue = False
       'Else

       '    '------------------------------------------------------------------------
       '    ' Not so for other chart types where values have more meaning than
       '    ' percentages.
       '    '------------------------------------------------------------------------
       '    oChartSpace.Charts(0).SeriesCollection(0).DataLabelsCollection(0).HasPercentage = False
       oChartSpace.Charts(0).SeriesCollection(0).DataLabelsCollection(0).HasValue = True
       'End If

       '------------------------------------------------------------------------
       ' Plug your own visual bells and whistles here
       ' ------------------------------------------------------------------------
       oChartSpace.Charts(0).SeriesCollection(0).Caption = "Cycletime vs Datapoints"
       oChartSpace.Charts(0).SeriesCollection(0).TipText = "Cycletime vs Datapoints"
       oChartSpace.Charts(0).SeriesCollection(0).DataLabelsCollection(0).Font.Name = "verdana"
       oChartSpace.Charts(0).SeriesCollection(0).DataLabelsCollection(0).Font.Size = 10
       oChartSpace.Charts(0).SeriesCollection(0).DataLabelsCollection(0).Font.Bold = True
       oChartSpace.Charts(0).SeriesCollection(0).DataLabelsCollection(0).Font.Color = "white"
       oChartSpace.Charts(0).SeriesCollection(0).DataLabelsCollection(0).Position = OWC11.ChartDataLabelPositionEnum.chLabelPositionCenter
       oChartSpace.Charts(0).SeriesCollection(0).Type = OWC11.ChartChartTypeEnum.chChartTypeLineStacked
       oChartSpace.Charts(0).SeriesCollection(0).Marker.Style = OWC11.ChartMarkerStyleEnum.chMarkerStyleCircle
       oChartSpace.Charts(0).SeriesCollection(0).Line.DashStyle = OWC11.ChartLineDashStyleEnum.chLineSquareDot

       oChartSpace.Charts(0).SeriesCollection(0).SetData(OWC11.ChartDimensionsEnum.chDimCategories, Convert.ToInt32(OWC11.ChartSpecialDataSourcesEnum.chDataLiteral), chartCategoriesStr)

       oChartSpace.Charts(0).SeriesCollection(0).SetData(OWC11.ChartDimensionsEnum.chDimValues, Convert.ToInt32(OWC11.ChartSpecialDataSourcesEnum.chDataLiteral), chartValuesStr)
       '------------------------------------------------------------------------
       ' Pick your favorite image forma
       ' ------------------------------------------------------------------------
       Dim height, width As Integer
       height = 500
       width = 700
       Dim byteArr As Byte() = DirectCast(oChartSpace.GetPicture("png", width, height), Byte())

       ' ------------------------------------------------------------------------
       ' Store the chart image in Session to be picked up by an HttpHandler later
       ' ------------------------------------------------------------------------
       Dim ctx As HttpContext = HttpContext.Current
       Dim chartID As String = Guid.NewGuid().ToString()

       ctx.Session(chartID) = byteArr
       imgGraph.ImageUrl = String.Concat("chart.ashx?", chartID)

   End Sub










oo.. by the way... i am using aspx (vb) thanks..
Answer -
Hi

If chartValuesArr.Length <= 50 Then
        For i = 0 To chartValuesArr.Length - 1
           if chartValuesArr(i) < 500 then
             chartValuesStr += chartValuesArr(i) + ","
             chartCategoriesStr += chartCategoriesArr(i)
+ ","
            end if
        Next
     Else

here you can check the value if greater than 500 don't add into your array.

Happy programming!!

-srini

Answer -
Can you conver the both values into the integer and give a try...

  if chartValuesArr(i) < textbox1.text then


Happy programming!!

-srini
Answer -
Hi

You can convert in your for loop

For i = 0 To chartValuesArr.Length - 1
        if chartValuesArr(i) < 500 then
         chartValuesStr += chartValuesArr(i) + ","
         chartCategoriesStr += chartCategoriesArr(i)
+ ","
         end if
      Next


You can round the Value so you should be able to maintain 5,10....

-srini

Answer
Okay, Here is what I understand, you need common values like 5,10....

If you need that  in the loop you are doing change the value by using Round function which converts the value for example if you have value 3 it will change to 5 and so on...

That whay you always have the value 5,10....

Happy Programming!

-srini

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.