INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Chart - DataSeries Order

Chart - DataSeries Order

(OP)
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 --> Powershell

# 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

RE: Chart - DataSeries Order

(OP)
To answer my own question:

(variables are different, but you get the idea)

CODE --> Powershell

$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" 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close