source: Dev/branches/rest-dojo-ui/client/dojox/charting/themes/Chris.js @ 256

Last change on this file since 256 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

File size: 2.4 KB
Line 
1define(["../Theme", "dojox/gfx/gradutils", "./common"], function(Theme, gradutils, themes){
2
3        // created by Christopher Anderson
4
5        var g = Theme.generateGradient,
6                defaultFill = {type: "linear", space: "shape", x1: 0, y1: 0, x2: 0, y2: 100};
7       
8        themes.Chris = new Theme({
9                chart: {
10                        fill:   "#c1c1c1",
11                        stroke: {color: "#666"}
12                },
13                plotarea: {
14                        fill: "#c1c1c1"
15                },
16                series: {
17                        stroke:  {width: 2, color: "white"},
18                        outline: null,
19                        fontColor: "#333"
20                },
21                marker: {
22                        stroke:  {width: 2, color: "white"},
23                        outline: {width: 2, color: "white"},
24                        fontColor: "#333"
25                },
26                seriesThemes: [
27                        {fill: g(defaultFill, "#01b717", "#238c01")},   // green
28                        {fill: g(defaultFill, "#d04918", "#7c0344")},   // red
29                        {fill: g(defaultFill, "#0005ec", "#002578")},   // blue
30                        {fill: g(defaultFill, "#f9e500", "#786f00")},   // yellow
31                        {fill: g(defaultFill, "#e27d00", "#773e00")},   // orange
32                        {fill: g(defaultFill, "#00b5b0", "#005f5d")},   // teal
33                        {fill: g(defaultFill, "#ac00cb", "#590060")}    // purple
34                ],
35                markerThemes: [
36                        {fill: "#01b717", stroke: {color: "#238c01"}},  // green
37                        {fill: "#d04918", stroke: {color: "#7c0344"}},  // red
38                        {fill: "#0005ec", stroke: {color: "#002578"}},  // blue
39                        {fill: "#f9e500", stroke: {color: "#786f00"}},  // yellow
40                        {fill: "#e27d00", stroke: {color: "#773e00"}},  // orange
41                        {fill: "#00b5b0", stroke: {color: "#005f5d"}},  // teal
42                        {fill: "#ac00cb", stroke: {color: "#590060"}}   // purple
43                ]
44        });
45       
46        themes.Chris.next = function(elementType, mixin, doPost){
47                var isLine = elementType == "line";
48                if(isLine || elementType == "area"){
49                        // custom processing for lines: substitute colors
50                        var s = this.seriesThemes[this._current % this.seriesThemes.length];
51                        s.fill.space = "plot";
52                        if(isLine){
53                                s.stroke  = {color: s.fill.colors[1].color};
54                                s.outline = {width: 2, color: "white"};
55                        }
56                        var theme = Theme.prototype.next.apply(this, arguments);
57                        // cleanup
58                        delete s.outline;
59                        delete s.stroke;
60                        s.fill.space = "shape";
61                        return theme;
62                }
63                return Theme.prototype.next.apply(this, arguments);
64        };
65       
66        themes.Chris.post = function(theme, elementType){
67                theme = Theme.prototype.post.apply(this, arguments);
68                if((elementType == "slice" || elementType == "circle") && theme.series.fill && theme.series.fill.type == "radial"){
69                        theme.series.fill = gradutils.reverse(theme.series.fill);
70                }
71                return theme;
72        };
73       
74        return themes.Chris;
75});
Note: See TracBrowser for help on using the repository browser.