Electric.js 2.6 KB

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