Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Chart - DataSeries Order

Status
Not open for further replies.

sn0rg

IS-IT--Management
Aug 5, 2005
95
0
0
GB
Hi All

I'm a bit of a novice with PS, and have been trying to create a graphic, following the tutorial here.

There a section where he enters x & y values using an array:
Code:
# add data to chart 
$Cities = @{London=7556900; Berlin=3429900; Madrid=3213271; Rome=2726539; 
            Paris=2188500} 
[void]$Chart.Series.Add("Data") 
$Chart.Series["Data"].Points.DataBindXY($Cities.Keys, $Cities.Values)

I've modified this to enter my own series of data, but it does not seem to have any specific order when displayed on the chart. I need the data to display in the order that I've entered it into the array - London, Berlin, Madrid, Rome, Paris (X axis). How can I do that?

Thanks
s
 
To answer my own question:

(variables are different, but you get the idea)

Code:
$mySeries1 = new-object System.Windows.Forms.DataVisualization.Charting.Series
[void]$mySeries1.Points.Add(14)
[void]$mySeries1.Points.Add(34)
[void]$mySeries1.Points.Add(42)
[void]$mySeries1.Points.Add(18)
[void]$mySeries1.Points.Add(24)
$myChart.Series.Add($mySeries1)

$myChart.Series["Series1"].Points[0].AxisLabel = "My Data 1"
$myChart.Series["Series1"].Points[1].AxisLabel = "My Data 2"
$myChart.Series["Series1"].Points[2].Label = "High Data"
$myChart.Series["Series1"].Points[2].AxisLabel = "My Data 3"
$myChart.Series["Series1"].Points[2].Color = "green"
$myChart.Series["Series1"].Points[3].AxisLabel = "My Data 4"
$myChart.Series["Series1"].Points[4].AxisLabel = "My Data 5"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top