p> 。 D:\Auto\Get-Corpchart-LightEdition.ps1-data $ active_inactive.GetEnumerator()-obj_keyName-obj_valueValue-filepathc:\chart1.pngtype types 查看脚本轻量级代码的代码,参数期待一个数组] 而不是散列表。 你最好根据hashtable的数据创建自己的自定义对象 [pscustomobject] @ { State =Active Value = 15 },[pscustomobject] @ { State =Inactive Value = 25 } 这种方法更有效的方法,所以上面的只是一个例子。 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.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 pieData in $active_inactive:Name Value---- -----inactive 7active 3Problem 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? 解决方案 If you wanted to use a hashtable I think you can if you call the .GetEnumarator() method. "D:\Auto\Get-Corpchart-LightEdition.ps1" -data $active_inactive.GetEnumerator() -obj_key "Name" -obj_value "Value" -filepath "c:\chart1.png" -type pieLooking 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'sdata depending on how complex your date would get.[pscustomobject]@{ State="Active" Value=15},[pscustomobject]@{ State="Inactive" Value=25}Tonnes of ways to do this more effectively so the above is just an example. 这篇关于图表创建中的散列问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-01 23:15