none
How to plot a graph using chart control in vb.net?

    Question

  • Hi ,

    I am doing my project in vb.net . I need to draw a graph for my project . I downloaded MSChart.exe file and i loaded into my toolbox. How to plot graph according to my textbox values in vb.net. Please help me and give sample codings.

    Advance Thanks.


      

    Friday, June 08, 2012 6:35 AM

All replies

  • Hi helpuser1

    can you explain a little more clearly what you want to do?

    According to my textbox values? What are the values?


    “This forum post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.”

    Saturday, June 09, 2012 4:51 AM
  • Hi jwavila 

    This is my coding 

    ''Chart1.Series.Add("Series2")
            ''Chart1.Series("Series2").ChartType = DataVisualization.Charting.SeriesChartType.Column
            ''Chart1.Series("Series2").Points.AddXY(2005, Recyclable.HDPERecyN2Txt.Text)
            ''Chart1.Series("Series2").Points.AddXY(2006, Recyclable.BinDenBD1Txt.Text)
            ''Chart1.Series("Series2").ChartArea = "ChartArea1"


    In  the third line instead of 2005 i need to add my combobox value for X-Co-ordinate. How can i use my combobox value. Please Guide me.

     
    Saturday, June 09, 2012 6:35 AM
  • maybe I'm missing something here, but you can simply use the ComboBox SelectedItem property

    Chart1.Series("Series2").Points.AddXY(ComboBox1.SelectedItem, HDPERecyN2Txt.Text)


    “This forum post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.”

    Saturday, June 09, 2012 7:53 AM
  • Thank u for your reply jwavila.

    I made like above your instruction its working well but i have to plot x co-ordinates from the year 2005 to 2050 in the interval of 5 by using this co-ordinates i have to plot my combobox value. Please help me ....

    Saturday, June 09, 2012 12:23 PM
  • if I'm understanding correctly, the chart will have X axis labels from 2005 to 2050 in intervals of 5

    these are the values you need in your ComboBox

    you can easily add those values into a combobox by using a a For...Next loop from 2005 to 2050 and using Step 5

    ifthis is a problem can you show the code you have where you populate the combobox?


    “This forum post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.”

    Saturday, June 09, 2012 1:38 PM