source: Dev/branches/rest-dojo-ui/client/dojox/charting/themes/Claro.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: 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                if(isLine || elementType == "area"){
72                        // custom processing for lines: substitute colors
73                        var s = this.seriesThemes[this._current % this.seriesThemes.length],
74                                m = this.markerThemes[this._current % this.markerThemes.length];
75                        s.fill.space = "plot";
76                        if(isLine){
77                                s.stroke  = { width: 4, color: s.fill.colors[0].color};
78                        }
79                        m.outline = { width: 1.25, color: m.fill };
80                        var theme = Theme.prototype.next.apply(this, arguments);
81                        // cleanup
82                        delete s.outline;
83                        delete s.stroke;
84                        s.fill.space = "shape";
85                        return theme;
86                }
87                else if(elementType == "candlestick"){
88                        var 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                        var 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.