Charged.js 2.6 KB

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