source: Dev/trunk/src/client/dojox/charting/themes/Claro.js

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 3.1 KB
Line 
1define(["../Theme", "dojox/gfx/gradutils", "./common"], function(Theme, gradutils, themes){
2        // created by Tom Trenka
3
4        var g = Theme.generateGradient,
5                defaultFill = {type: "linear", space: "shape", x1: 0, y1: 0, x2: 0, y2: 100};
6       
7        themes.Claro = new Theme({
8                chart: {
9                        fill:      {
10                                type: "linear",
11                                x1: 0, x2: 0, y1: 0, y2: 100,
12                                colors: [
13                                        { offset: 0, color: "#dbdbdb" },
14                                        { offset: 1, color: "#efefef" }
15                                ]
16                        },
17                        stroke:    {color: "#b5bcc7"}
18                },
19                plotarea: {
20                        fill:      {
21                                type: "linear",
22                                x1: 0, x2: 0, y1: 0, y2: 100,
23                                colors: [
24                                        { offset: 0, color: "#dbdbdb" },
25                                        { offset: 1, color: "#efefef" }
26                                ]
27                        }
28                },
29                axis:{
30                        stroke: { // the axis itself
31                                color: "#888c76",
32                                width: 1
33                        },
34                        tick: { // used as a foundation for all ticks
35                                color:     "#888c76",
36                                position:  "center",
37                                font:      "normal normal normal 7pt Verdana, Arial, sans-serif",       // labels on axis
38                                fontColor: "#888c76"                                                            // color of labels
39                        }
40                },
41                series: {
42                        stroke:  {width: 2.5, color: "#fff"},
43                        outline: null,
44                        font: "normal normal normal 7pt Verdana, Arial, sans-serif",
45                        fontColor: "#131313"
46                },
47                marker: {
48                        stroke:  {width: 1.25, color: "#131313"},
49                        outline: {width: 1.25, color: "#131313"},
50                        font: "normal normal normal 8pt Verdana, Arial, sans-serif",
51                        fontColor: "#131313"
52                },
53                seriesThemes: [
54                        {fill: g(defaultFill, "#2a6ead", "#3a99f2")},
55                        {fill: g(defaultFill, "#613e04", "#996106")},
56                        {fill: g(defaultFill, "#0e3961", "#155896")},
57                        {fill: g(defaultFill, "#55aafa", "#3f7fba")},
58                        {fill: g(defaultFill, "#ad7b2a", "#db9b35")}
59                ],
60                markerThemes: [
61                        {fill: "#2a6ead", stroke: {color: "#fff"}},
62                        {fill: "#613e04", stroke: {color: "#fff"}},
63                        {fill: "#0e3961", stroke: {color: "#fff"}},
64                        {fill: "#55aafa", stroke: {color: "#fff"}},
65                        {fill: "#ad7b2a", stroke: {color: "#fff"}}
66                ]
67        });
68       
69        themes.Claro.next = function(elementType, mixin, doPost){
70                var isLine = elementType == "line",
71                        s, theme;
72                if(isLine || elementType == "area"){
73                        // custom processing for lines: substitute colors
74                        s = this.seriesThemes[this._current % this.seriesThemes.length];
75                        var m = this.markerThemes[this._current % this.markerThemes.length];
76                        s.fill.space = "plot";
77                        if(isLine){
78                                s.stroke  = { width: 4, color: s.fill.colors[0].color};
79                        }
80                        m.outline = { width: 1.25, color: m.fill };
81                        theme = Theme.prototype.next.apply(this, arguments);
82                        // cleanup
83                        delete s.outline;
84                        delete s.stroke;
85                        s.fill.space = "shape";
86                        return theme;
87                }else if(elementType == "candlestick"){
88                        s = this.seriesThemes[this._current % this.seriesThemes.length];
89                        s.fill.space = "plot";
90                        s.stroke  = { width: 1, color: s.fill.colors[0].color};
91                        theme = Theme.prototype.next.apply(this, arguments);
92                        return theme;
93                }
94                return Theme.prototype.next.apply(this, arguments);
95        };
96       
97        themes.Claro.post = function(theme, elementType){
98                theme = Theme.prototype.post.apply(this, arguments);
99                if((elementType == "slice" || elementType == "circle") && theme.series.fill && theme.series.fill.type == "radial"){
100                        theme.series.fill = gradutils.reverse(theme.series.fill);
101                }
102                return theme;
103        };
104       
105        return themes.Claro;
106});
Note: See TracBrowser for help on using the repository browser.