Chris.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. define("dojox/charting/themes/Chris", ["../Theme", "dojox/gfx/gradutils", "./common"], function(Theme, gradutils, themes){
  2. // created by Christopher Anderson
  3. var g = Theme.generateGradient,
  4. defaultFill = {type: "linear", space: "shape", x1: 0, y1: 0, x2: 0, y2: 100};
  5. themes.Chris = new Theme({
  6. chart: {
  7. fill: "#c1c1c1",
  8. stroke: {color: "#666"}
  9. },
  10. plotarea: {
  11. fill: "#c1c1c1"
  12. },
  13. series: {
  14. stroke: {width: 2, color: "white"},
  15. outline: null,
  16. fontColor: "#333"
  17. },
  18. marker: {
  19. stroke: {width: 2, color: "white"},
  20. outline: {width: 2, color: "white"},
  21. fontColor: "#333"
  22. },
  23. seriesThemes: [
  24. {fill: g(defaultFill, "#01b717", "#238c01")}, // green
  25. {fill: g(defaultFill, "#d04918", "#7c0344")}, // red
  26. {fill: g(defaultFill, "#0005ec", "#002578")}, // blue
  27. {fill: g(defaultFill, "#f9e500", "#786f00")}, // yellow
  28. {fill: g(defaultFill, "#e27d00", "#773e00")}, // orange
  29. {fill: g(defaultFill, "#00b5b0", "#005f5d")}, // teal
  30. {fill: g(defaultFill, "#ac00cb", "#590060")} // purple
  31. ],
  32. markerThemes: [
  33. {fill: "#01b717", stroke: {color: "#238c01"}}, // green
  34. {fill: "#d04918", stroke: {color: "#7c0344"}}, // red
  35. {fill: "#0005ec", stroke: {color: "#002578"}}, // blue
  36. {fill: "#f9e500", stroke: {color: "#786f00"}}, // yellow
  37. {fill: "#e27d00", stroke: {color: "#773e00"}}, // orange
  38. {fill: "#00b5b0", stroke: {color: "#005f5d"}}, // teal
  39. {fill: "#ac00cb", stroke: {color: "#590060"}} // purple
  40. ]
  41. });
  42. themes.Chris.next = function(elementType, mixin, doPost){
  43. var isLine = elementType == "line";
  44. if(isLine || elementType == "area"){
  45. // custom processing for lines: substitute colors
  46. var s = this.seriesThemes[this._current % this.seriesThemes.length];
  47. s.fill.space = "plot";
  48. if(isLine){
  49. s.stroke = {color: s.fill.colors[1].color};
  50. s.outline = {width: 2, color: "white"};
  51. }
  52. var theme = Theme.prototype.next.apply(this, arguments);
  53. // cleanup
  54. delete s.outline;
  55. delete s.stroke;
  56. s.fill.space = "shape";
  57. return theme;
  58. }
  59. return Theme.prototype.next.apply(this, arguments);
  60. };
  61. themes.Chris.post = function(theme, elementType){
  62. theme = Theme.prototype.post.apply(this, arguments);
  63. if((elementType == "slice" || elementType == "circle") && theme.series.fill && theme.series.fill.type == "radial"){
  64. theme.series.fill = gradutils.reverse(theme.series.fill);
  65. }
  66. return theme;
  67. };
  68. return themes.Chris;
  69. });