Iron Speed Technical Forums
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
rshope

Registered:
Posts: 93
Reply with quote  #1 
This is one I really wanted to do, so I imagine there are others who want to do the same. After some digging, here's how I found the best way to customize your pie chart colors:

After your Chart has been generated, edit the Set() code customization. Scroll to the bottom below:


Me.Page.InitializeChartControl(args.ToArray())


This is where we'll be iterating through the series of the chart in order to change the properties of the points it contains. Here's an example:


For Each charts As DataVisualization.Charting.Series In chartControl.Series
                For Each point As DataVisualization.Charting.DataPoint In charts.Points
                    Select Case point.AxisLabel
                        Case "Value1" ' Change color for value1 slice
                            point.Color = System.Drawing.Color.Purple
                            Exit For
                        Case "Value2" ' Change color for value2 slice
                            point.Color = System.Drawing.Color.Green
                            Exit For
                        Case "Value3" ' Change color for value3 slice
                            point.Color = System.Drawing.Color.Orange
                            Exit For
                    End Select
                Next
            Next


Hopefully someone finds this helpful!
Guy

Registered:
Posts: 21
Reply with quote  #2 
This does look extremely useful, thanks for posting it. However, I must be doing something wrong (and forgive my ignorance, but I don't profess to be a programmer, which is why I use Ironspeed).

I generated a chart, and then I edited the set() code, and the following was shown in the window:

Public Sub SetTotalItemsSumChart()
SetTotalItemsSumChart_Base() 
End Sub

Do I take the code that was in the original generated Public Sub SetTotalItemsSumChart_Base(), in which a "Me.InitializeChartControl(args.ToArray())" section exists, and copy it into the above? I did try that but then get error messages such as ": sub 'SetTotalItemsSumChart' cannot be declared 'Overrides' because it does not override a sub in a base class."

Any advice you can offer me would be greatly appreciated!

Thanks

Guy



vmnz

Registered:
Posts: 41
Reply with quote  #3 
Thanks, this is brilliant. [thumb]

Started working properly only when I've removed all the "Exit For"s, though.

Before that just a single bar in chart was getting new color.
Guy

Registered:
Posts: 21
Reply with quote  #4 
I agree, it is brilliant, and I finally got it to work, not sure what I was doing wrong! Managed to produce a graph showing percentage of critical versus non-critical failures at service stations, by region, with the critical in red and the non-critical in green - exactly what was needed. 

Many thanks for sharing this, once again.


silvertri

Registered:
Posts: 6
Reply with quote  #5 
so here I am in 2019 still happily using Ironspeed *with licensing locked out and I look for a random chart requirement re select color coding and I find what I want , thanks a lot rshope 
and thanks to IS  great product that was years ahead of its time....especially for non coders!
silvertri

Registered:
Posts: 6
Reply with quote  #6 
Further to this link I now need to have a chart with multiple series e.g Budget & Actual in one chart can anybody please post the mods required to set up via the customise option ..TiA

sample.png 

Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.

Download Iron Speed Designer

Terms of Service Privacy Statement