How to create a heatmap doughnut chart, as in the example shown below Lets say that we want to create a circular color ramp, as used in This is actually 2 steps, using this data
Here are the calculated colors here's the snippet for that ' and the target colors based on the values For j = LBound(aColors, 2) To UBound(aColors, 2) For i = 1 To ds.rows.count aColors(i + 1, j) = _ rampLibraryRGB(colorRampName, mn, mx, ds.value(i, j), brighten) Next i ' for cycling - add the last color at beginning and first color at end aColors(1, j) = aColors(1 + ds.rows.count, j) aColors(2 + ds.rows.count, j) = aColors(2, j) Next j Since each slice of the doughnut is now of equal size, (remember we are using color instead of size to show intensity), the color of each slice is calculated by its relative position along this circular scale, as per the snippet below ' dealing with this point o = (i - 1) * granularity + j + 1 ' note we are already half a granularity along with 1st point props = makeColorProps(colorRamp _ (1, (granularity * (ds.rows.count + 1)), o + granularity / 2, _ extractArrayItem(aColors, k))) Here's the complete code for the module that creates the chart. For help and more information join our forum,follow the blog or follow me on twitter .
|
Services > Desktop Liberation - the definitive resource for Google Apps Script and Microsoft Office automation > Color Fiesta > Create a heatmap in Excel > Color ramp library >