source: Dev/branches/rest-dojo-ui/client/dojox/charting/themes/Electric.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        var g = Theme.generateGradient,
4                defaultFill = {type: "linear", space: "shape", x1: 0, y1: 0, x2: 0, y2: 75};
5       
6        themes.Electric = new Theme({
7                chart: {
8                        fill:      "#252525",
9                        stroke:    {color: "#252525"},
10                        pageStyle: {backgroundColor: "#252525", backgroundImage: "none", color: "#ccc"}
11                },
12                plotarea: {
13                        fill: "#252525"
14                },
15                axis:{
16                        stroke: { // the axis itself
17                                color: "#aaa",
18                                width: 1
19                        },
20                        tick: { // used as a foundation for all ticks
21                                color:     "#777",
22                                position:  "center",
23                                font:      "normal normal normal 7pt Helvetica, Arial, sans-serif",     // labels on axis
24                                fontColor: "#777"                                                               // color of labels
25                        }
26                },
27                series: {
28                        stroke:  {width: 2, color: "#ccc"},
29                        outline: null,
30                        font: "normal normal normal 8pt Helvetica, Arial, sans-serif",
31                        fontColor: "#ccc"
32                },
33                marker: {
34                        stroke:  {width: 3, color: "#ccc"},
35                        outline: null,
36                        font: "normal normal normal 8pt Helvetica, Arial, sans-serif",
37                        fontColor: "#ccc"
38                },
39                seriesThemes: [
40                        {fill: g(defaultFill, "#004cbf", "#06f")},
41                        {fill: g(defaultFill, "#bf004c", "#f06")},
42                        {fill: g(defaultFill, "#43bf00", "#6f0")},
43                        {fill: g(defaultFill, "#7300bf", "#90f")},
44                        {fill: g(defaultFill, "#bf7300", "#f90")},
45                        {fill: g(defaultFill, "#00bf73", "#0f9")}
46                ],
47                markerThemes: [
48                        {fill: "#06f", stroke: {color: "#06f"}},
49                        {fill: "#f06", stroke: {color: "#f06"}},
50                        {fill: "#6f0", stroke: {color: "#6f0"}},
51                        {fill: "#90f", stroke: {color: "#90f"}},
52                        {fill: "#f90", stroke: {color: "#f90"}},
53                        {fill: "#0f9", stroke: {color: "#0f9"}}
54                ]
55        });
56       
57        themes.Electric.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: 2.5, color: s.fill.colors[1].color};
65                        }
66                        if(elementType == "area"){
67                                s.fill.y2 = 90;
68                        }
69                        var theme = Theme.prototype.next.apply(this, arguments);
70                        // cleanup
71                        delete s.stroke;
72                        s.fill.y2 = 75;
73                        s.fill.space = "shape";
74                        return theme;
75                }
76                return Theme.prototype.next.apply(this, arguments);
77        };
78       
79        themes.Electric.post = function(theme, elementType){
80                theme = Theme.prototype.post.apply(this, arguments);
81                if((elementType == "slice" || elementType == "circle") && theme.series.fill && theme.series.fill.type == "radial"){
82                        theme.series.fill = gradutils.reverse(theme.series.fill);
83                }
84                return theme;
85        };
86       
87        return themes.Electric;
88});
Note: See TracBrowser for help on using the repository browser.