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