I am trying to create chart by Get-CorpChart-FullEdition
script, which I found very good in chart creation.
On the website I found below instruction.
So now, all what you have to do is to give the
$Cities
array to the function as-Data
parameter, and supply the-Obj_Key
parameter as "City_Name", and-Obj_Value
as "City_Population"
I created a hash like this:
$active_inactive = @{}
$red = 15
$orange = 25
$active_inactive['active']= $red
$active_inactive['inactive'] = $orange
. "D:\Auto\Get-Corpchart-LightEdition.ps1" -data $active_inactive -obj_key "Name" -obj_value "Value" -filepath "c:\chart1.png" -type pie
Data in $active_inactive
:
Name Value ---- ----- inactive 7 active 3
Problem is I am getting a blank chart1.png file. It seems like issue with my hashtable.
Can anybody advise me if I am creating the hashtable properly as described above or not?
-data
expects an array of objects, not a hashtable.If you wanted to use a hashtable I think you can if you call the
.GetEnumarator()
methodLooking at the code for the light edition of the script the parameter is expecting an
[array]
and not a hashtable.You would be better of creating your own custom objects from that hashtable's data depending on how complex your date would get.
Tonnes of ways to do this more effectively so the above is just an example.