Welcome Guest Search | Active Topics |

Custom colors for stacked bar
cpmbailey
#1 Posted : Friday, March 22, 2013 10:35:02 AM(UTC)
Rank: Member

Groups: ExpiredLicense, Registered
Joined: 3/19/2013(UTC)
Posts: 10

Thanks: 2 times
Was thanked: 0 time(s) in 0 post(s)
Is it possible to specify custom colors for each segment of a stacked bar such that they are different for all series'? It might seem a slightly bizarre thing to do but if you set all y values to 1 and then set the x gap to 0, it's quite an effective way to get a heatmap.
Dragan
#2 Posted : Friday, March 22, 2013 1:15:01 PM(UTC)
Rank: Advanced Member

Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered
Joined: 1/3/2011(UTC)
Posts: 483

Thanks: 0 times
Was thanked: 87 time(s) in 87 post(s)
You can specify individual bar colors with:

Code:
$(document).ready(function () {
            $('#jqChart').jqChart({               
                series: [
                            {
                                type: 'stackedBar',
                                title: 'Stacked 1',
                                data: [62, 70, 68],
                                fillStyles: ['red', 'blue', 'orange']
                            },
                            {
                                type: 'stackedBar',
                                title: 'Stacked 2',
                                data: [56, 30, 62],
                                fillStyles: ['yellow', 'green', 'aqua']
                            },
                            {
                                type: 'stackedBar',
                                title: 'Stacked 3',
                                data: [33, 42, 54],
                                fillStyles: ['gray', 'black', 'purple']
                            }
                ]
            });
        });
Best Regards,
Dragan Matek
jqChart Inc.
1 user thanked Dragan for this useful post.
cpmbailey on 3/22/2013(UTC)
cpmbailey
#3 Posted : Friday, March 22, 2013 1:55:45 PM(UTC)
Rank: Member

Groups: ExpiredLicense, Registered
Joined: 3/19/2013(UTC)
Posts: 10

Thanks: 2 times
Was thanked: 0 time(s) in 0 post(s)
Ah thanks, I was trying to use paletteColors but that only gave you a set that applied to each series
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

FlatEarth Theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.075 seconds.