Julie.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
  3. Available via Academic Free License >= 2.1 OR the modified BSD license.
  4. see: http://dojotoolkit.org/license for details
  5. */
  6. if(!dojo._hasResource["dojox.charting.themes.Julie"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  7. dojo._hasResource["dojox.charting.themes.Julie"] = true;
  8. dojo.provide("dojox.charting.themes.Julie");
  9. dojo.require("dojox.gfx.gradutils");
  10. dojo.require("dojox.charting.Theme");
  11. // created by Julie Santilli
  12. (function(){
  13. var dc = dojox.charting, themes = dc.themes, Theme = dc.Theme, g = Theme.generateGradient,
  14. defaultFill = {type: "linear", space: "shape", x1: 0, y1: 0, x2: 0, y2: 100};
  15. themes.Julie = new dc.Theme({
  16. seriesThemes: [
  17. {fill: g(defaultFill, "#59a0bd", "#497c91"), stroke: {color: "#22627d"}}, // blue
  18. {fill: g(defaultFill, "#8d88c7", "#6c6d8e"), stroke: {color: "#8a84c5"}}, // purple
  19. {fill: g(defaultFill, "#85a54a", "#768b4e"), stroke: {color: "#5b6d1f"}}, // green
  20. {fill: g(defaultFill, "#e8e667", "#c6c361"), stroke: {color: "#918e38"}}, // yellow
  21. {fill: g(defaultFill, "#e9c756", "#c7a223"), stroke: {color: "#947b30"}}, // orange
  22. {fill: g(defaultFill, "#a05a5a", "#815454"), stroke: {color: "#572828"}}, // red
  23. {fill: g(defaultFill, "#b17044", "#72543e"), stroke: {color: "#74482e"}}, // brown
  24. {fill: g(defaultFill, "#a5a5a5", "#727272"), stroke: {color: "#535353"}}, // grey
  25. {fill: g(defaultFill, "#9dc7d9", "#59a0bd"), stroke: {color: "#22627d"}}, // blue
  26. {fill: g(defaultFill, "#b7b3da", "#8681b3"), stroke: {color: "#8a84c5"}}, // purple
  27. {fill: g(defaultFill, "#a8c179", "#85a54a"), stroke: {color: "#5b6d1f"}}, // green
  28. {fill: g(defaultFill, "#eeea99", "#d6d456"), stroke: {color: "#918e38"}}, // yellow
  29. {fill: g(defaultFill, "#ebcf81", "#e9c756"), stroke: {color: "#947b30"}}, // orange
  30. {fill: g(defaultFill, "#c99999", "#a05a5a"), stroke: {color: "#572828"}}, // red
  31. {fill: g(defaultFill, "#c28b69", "#7d5437"), stroke: {color: "#74482e"}}, // brown
  32. {fill: g(defaultFill, "#bebebe", "#8c8c8c"), stroke: {color: "#535353"}}, // grey
  33. {fill: g(defaultFill, "#c7e0e9", "#92baca"), stroke: {color: "#22627d"}}, // blue
  34. {fill: g(defaultFill, "#c9c6e4", "#ada9d6"), stroke: {color: "#8a84c5"}}, // purple
  35. {fill: g(defaultFill, "#c0d0a0", "#98ab74"), stroke: {color: "#5b6d1f"}}, // green
  36. {fill: g(defaultFill, "#f0eebb", "#dcd87c"), stroke: {color: "#918e38"}}, // yellow
  37. {fill: g(defaultFill, "#efdeb0", "#ebcf81"), stroke: {color: "#947b30"}}, // orange
  38. {fill: g(defaultFill, "#ddc0c0", "#c99999"), stroke: {color: "#572828"}}, // red
  39. {fill: g(defaultFill, "#cfb09b", "#c28b69"), stroke: {color: "#74482e"}}, // brown
  40. {fill: g(defaultFill, "#d8d8d8", "#bebebe"), stroke: {color: "#535353"}}, // grey
  41. {fill: g(defaultFill, "#ddeff5", "#a5c4cd"), stroke: {color: "#22627d"}}, // blue
  42. {fill: g(defaultFill, "#dedcf0", "#b3afd3"), stroke: {color: "#8a84c5"}}, // purple
  43. {fill: g(defaultFill, "#dfe9ca", "#c0d0a0"), stroke: {color: "#5b6d1f"}}, // green
  44. {fill: g(defaultFill, "#f8f7db", "#e5e28f"), stroke: {color: "#918e38"}}, // yellow
  45. {fill: g(defaultFill, "#f7f0d8", "#cfbd88"), stroke: {color: "#947b30"}}, // orange
  46. {fill: g(defaultFill, "#eedede", "#caafaf"), stroke: {color: "#572828"}}, // red
  47. {fill: g(defaultFill, "#e3cdbf", "#cfb09b"), stroke: {color: "#74482e"}}, // brown
  48. {fill: g(defaultFill, "#efefef", "#cacaca"), stroke: {color: "#535353"}} // grey
  49. ]
  50. });
  51. themes.Julie.next = function(elementType, mixin, doPost){
  52. if(elementType == "line" || elementType == "area"){
  53. var s = this.seriesThemes[this._current % this.seriesThemes.length];
  54. s.fill.space = "plot";
  55. var theme = Theme.prototype.next.apply(this, arguments);
  56. s.fill.space = "shape";
  57. return theme;
  58. }
  59. return Theme.prototype.next.apply(this, arguments);
  60. };
  61. themes.Julie.post = function(theme, elementType){
  62. theme = Theme.prototype.post.apply(this, arguments);
  63. if(elementType == "slice" && theme.series.fill && theme.series.fill.type == "radial"){
  64. theme.series.fill = dojox.gfx.gradutils.reverse(theme.series.fill);
  65. }
  66. return theme;
  67. };
  68. })();
  69. }