how do i create a scatter plot with 2 1-D arrays?
my only objective is to create a scatter plot with only x and y axes. the data source should be from a 1 dimensional array.
say i have these arrays:
- x() as Object ' for x axis values
- y() as Object ' for y axis values
and i have this chart:
chart1
the arrays are already filled with data. my question is: how do i enter the array data on chart1 such that x() values wi开发者_运维百科ll be the x-axis values for chart 1 and y() will be the y-axis values for chart 1. what code should i use to make the chart show a scatter plot using the data from the arrays?
your reply will be very much appreciated. thanks in advance.
Look at chart properties under Chart>Series and change Series1 ChartType to Point.
Dim x() As Integer = {1, 2, 3, 4, 5}
Dim y() As Integer = {2, 1, 7, 3, 3}
Chart1.Series("Series1").Points.DataBindXY(x, y)
Check out Zedgraph. It's a free graphing library that works great. There are lots of code samples on their website that allow you to do what you're asking. Zedgraph Downloads Their website seems to be having issues right now, but the download session works and contains all of their sample files.
精彩评论