I am creating a pie chart and using a color palette "Semitransparent". I am getting the output in the attached file.
Please suggest which property I need to change to get the desired output.
e.g. I need to set two colors "Red" and "green" for success and failure status in the PIE chart. How do set the color property for this?
I need to change palette color order or add custom color and give first preference order.Need to add and change custom color for PIE chart
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- Abhishek_Paul
- Posts: 24
- Last visit: Fri Jun 15, 2018 2:04 am
Re: Need to add and change custom color for PIE chart
Colors are set based on the value of the items in the chart. YOu have to set the color for each item.
Here is a good place to start learning the chart control. https://www.sapien.com/blog/2011/05/05/ ... powershell
Here is a good place to start learning the chart control. https://www.sapien.com/blog/2011/05/05/ ... powershell
- Abhishek_Paul
- Posts: 24
- Last visit: Fri Jun 15, 2018 2:04 am
Re: Need to add and change custom color for PIE chart
Thanks, Jivierra.
I have already referred to that article and I am able to get the output. However, I am not able to set the custom color for each value as per my need.
Which property needs to be changed to set the custom color or reorder the color palette.
I have already referred to that article and I am able to get the output. However, I am not able to set the custom color for each value as per my need.
Which property needs to be changed to set the custom color or reorder the color palette.
Re: Need to add and change custom color for PIE chart
If you are trying to use the Chart Control sets then this property does not work. The base code is incorrect and fails to crate a pallet set before assigning to the "PalletCustomColors" property. You can add this in the form load event and set the colors you want.
$custompallet = <your chart object>.PalletCustomColors = [System.Drawing.Color[]]::New(16)
Now assign colors to each entry.
Set the pallet for the series to "None" and the custom palette should show.
$custompallet = <your chart object>.PalletCustomColors = [System.Drawing.Color[]]::New(16)
Now assign colors to each entry.
Set the pallet for the series to "None" and the custom palette should show.
- Abhishek_Paul
- Posts: 24
- Last visit: Fri Jun 15, 2018 2:04 am
Re: Need to add and change custom color for PIE chart
Hi Jivierra,
I was going through some article. There it says it's possible to set the maximum and minimum value a colour.
How Can I use this in my Powershell studio pie chart?
I tried to change the chart variable and series name . but it doesn't work.
I was going through some article. There it says it's possible to set the maximum and minimum value a colour.
Code: Select all
# Find point with max/min values and change their colour
$maxValuePoint = $Chart.Series["Data"].Points.FindMaxByValue()
$maxValuePoint.Color = [System.Drawing.Color]::Red
$minValuePoint = $Chart.Series["Data"].Points.FindMinByValue()
$minValuePoint.Color = [System.Drawing.Color]::Green
I tried to change the chart variable and series name . but it doesn't work.
- Abhishek_Paul
- Posts: 24
- Last visit: Fri Jun 15, 2018 2:04 am
Re: Need to add and change custom color for PIE chart
I am attaching the psf file for your reference. Please help me change the custom color.