Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

PowerShell Excel Chart with multiple scales

$
0
0

I have been playing with PowerShell and Excel to create charts of some benchmark data.  I am slowly getting there.  After a couple days of browsing the web and reading examples, I have put together a script that gets me part of the way to where I want to be.  Here is what I have been able to come up with so far.

As you can see, I am trying to show IOPS against latency, but obviously the scales are significantly different.  I would like to put a different scale on the right hand side of the chart that better reflects the lower values for latency.

Additionally, I would like to change the IOPS to a bar chart while having the latency chart remain a line marker chart.

Does someone have some sample code showing me the basics of how to get two scales and two styles on the same chart?

Here is the pertinent part of my code that is used for the above chart.

$xlChartType     = [Microsoft.Office.Interop.Excel.XLChartType]

$ch.chartType=$xlChartType::xlLineMarkers
$ch.SeriesCollection.NewSeries
$ch.SeriesCollection(1).Values  = $ws.Range("B18:G18")
$ch.SeriesCollection(1).Name    = "IOPs"
$ch.SeriesCollection(1).XValues = $ws.Range("B17:G17")
$trash = $ch.SeriesCollection().NewSeries.Invoke()
$ch.SeriesCollection(2).Values  = $ws.Range("B20:G20")
$ch.SeriesCollection(2).Name    = "Latency"
$ch.SeriesCollection(2).XValues = $ws.Range("B17:G17")

I am not using the MS Chart Controls.  This script is going to be run by non-PowerShell users, so I don't want to include instructions on how to install that.  (If it did not use .NET 3.5, I might consider it, but I don't want to add that just for a plug-in.)

Thanks for the guidance.


. : | : . : | : . tim


Viewing all articles
Browse latest Browse all 11829

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>