Tom.js 2.6 KB

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