source: Dev/branches/rest-dojo-ui/client/dojox/charting/themes/Tom.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.6 KB
Line 
1define(["../Theme", "dojox/gfx/gradutils", "./common"], function(Theme, gradutils, themes){
2
3        // created by Tom Trenka
4       
5        var g = Theme.generateGradient,
6                defaultFill = {type: "linear", space: "shape", x1: 0, y1: 0, x2: 0, y2: 100};
7       
8        themes.Tom = new Theme({
9                chart: {
10                        fill:      "#181818",
11                        stroke:    {color: "#181818"},
12                        pageStyle: {backgroundColor: "#181818", backgroundImage: "none", color: "#eaf2cb"}
13                },
14                plotarea: {
15                        fill: "#181818"
16                },
17                axis:{
18                        stroke: { // the axis itself
19                                color: "#a0a68b",
20                                width: 1
21                        },
22                        tick: { // used as a foundation for all ticks
23                                color:     "#888c76",
24                                position:  "center",
25                                font:      "normal normal normal 7pt Helvetica, Arial, sans-serif",     // labels on axis
26                                fontColor: "#888c76"    // color of labels
27                        }
28                },
29                series: {
30                        stroke:  {width: 2.5, color: "#eaf2cb"},
31                        outline: null,
32                        font: "normal normal normal 8pt Helvetica, Arial, sans-serif",
33                        fontColor: "#eaf2cb"
34                },
35                marker: {
36                        stroke:  {width: 1.25, color: "#eaf2cb"},
37                        outline: {width: 1.25, color: "#eaf2cb"},
38                        font: "normal normal normal 8pt Helvetica, Arial, sans-serif",
39                        fontColor: "#eaf2cb"
40                },
41                seriesThemes: [
42                        {fill: g(defaultFill, "#bf9e0a", "#ecc20c")},
43                        {fill: g(defaultFill, "#73b086", "#95e5af")},
44                        {fill: g(defaultFill, "#c7212d", "#ed2835")},
45                        {fill: g(defaultFill, "#87ab41", "#b6e557")},
46                        {fill: g(defaultFill, "#b86c25", "#d37d2a")}
47                ],
48                markerThemes: [
49                        {fill: "#bf9e0a", stroke: {color: "#ecc20c"}},
50                        {fill: "#73b086", stroke: {color: "#95e5af"}},
51                        {fill: "#c7212d", stroke: {color: "#ed2835"}},
52                        {fill: "#87ab41", stroke: {color: "#b6e557"}},
53                        {fill: "#b86c25", stroke: {color: "#d37d2a"}}
54                ]
55        });
56       
57        themes.Tom.next = function(elementType, mixin, doPost){
58                var isLine = elementType == "line";
59                if(isLine || elementType == "area"){
60                        // custom processing for lines: substitute colors
61                        var s = this.seriesThemes[this._current % this.seriesThemes.length];
62                        s.fill.space = "plot";
63                        if(isLine){
64                                s.stroke  = { width: 4, color: s.fill.colors[0].color};
65                        }
66                        var theme = Theme.prototype.next.apply(this, arguments);
67                        // cleanup
68                        delete s.outline;
69                        delete s.stroke;
70                        s.fill.space = "shape";
71                        return theme;
72                }
73                return Theme.prototype.next.apply(this, arguments);
74        };
75       
76        themes.Tom.post = function(theme, elementType){
77                theme = Theme.prototype.post.apply(this, arguments);
78                if((elementType == "slice" || elementType == "circle") && theme.series.fill && theme.series.fill.type == "radial"){
79                        theme.series.fill = gradutils.reverse(theme.series.fill);
80                }
81                return theme;
82        };
83       
84        return themes.Tom;
85});
Note: See TracBrowser for help on using the repository browser.