Renkoo.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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.Renkoo"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  7. dojo._hasResource["dojox.charting.themes.Renkoo"] = true;
  8. dojo.provide("dojox.charting.themes.Renkoo");
  9. dojo.require("dojox.gfx.gradutils");
  10. dojo.require("dojox.charting.Theme");
  11. // created by Tom Trenka
  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: 150};
  15. themes.Renkoo = new dc.Theme({
  16. chart: {
  17. fill: "#123666",
  18. pageStyle: {backgroundColor: "#123666", backgroundImage: "none", color: "#95afdb"}
  19. },
  20. plotarea: {
  21. fill: "#123666"
  22. },
  23. axis:{
  24. stroke: { // the axis itself
  25. color: "#95afdb",
  26. width: 1
  27. },
  28. tick: { // used as a foundation for all ticks
  29. color: "#95afdb",
  30. position: "center",
  31. font: "normal normal normal 7pt Lucida Grande, Helvetica, Arial, sans-serif", // labels on axis
  32. fontColor: "#95afdb" // color of labels
  33. }
  34. },
  35. series: {
  36. stroke: {width: 2.5, color: "#123666"},
  37. outline: null,
  38. font: "normal normal normal 8pt Lucida Grande, Helvetica, Arial, sans-serif", // labels on axis
  39. fontColor: "#95afdb"
  40. },
  41. marker: {
  42. stroke: {width: 2.5, color: "#ccc"},
  43. outline: null,
  44. font: "normal normal normal 8pt Lucida Grande, Helvetica, Arial, sans-serif", // labels on axis
  45. fontColor: "#95afdb"
  46. },
  47. seriesThemes: [
  48. {fill: g(defaultFill, "#e7e391", "#f8f7de")},
  49. {fill: g(defaultFill, "#ffb6b6", "#ffe8e8")},
  50. {fill: g(defaultFill, "#bcda7d", "#eef7da")},
  51. {fill: g(defaultFill, "#d5d5d5", "#f4f4f4")},
  52. {fill: g(defaultFill, "#c1e3fd", "#e4f3ff")}
  53. ],
  54. markerThemes: [
  55. {fill: "#fcfcf3", stroke: {color: "#e7e391"}},
  56. {fill: "#fff1f1", stroke: {color: "#ffb6b6"}},
  57. {fill: "#fafdf4", stroke: {color: "#bcda7d"}},
  58. {fill: "#fbfbfb", stroke: {color: "#d5d5d5"}},
  59. {fill: "#f3faff", stroke: {color: "#c1e3fd"}}
  60. ]
  61. });
  62. themes.Renkoo.next = function(elementType, mixin, doPost){
  63. if("slice,column,bar".indexOf(elementType) == -1){
  64. // custom processing to substitute colors
  65. var s = this.seriesThemes[this._current % this.seriesThemes.length];
  66. s.fill.space = "plot";
  67. s.stroke = { width: 2, color: s.fill.colors[0].color};
  68. if(elementType == "line" || elementType == "area"){
  69. s.stroke.width = 4;
  70. }
  71. var theme = Theme.prototype.next.apply(this, arguments);
  72. // cleanup
  73. delete s.stroke;
  74. s.fill.space = "shape";
  75. return theme;
  76. }
  77. return Theme.prototype.next.apply(this, arguments);
  78. };
  79. themes.Renkoo.post = function(theme, elementType){
  80. theme = Theme.prototype.post.apply(this, arguments);
  81. if((elementType == "slice" || elementType == "circle") && theme.series.fill && theme.series.fill.type == "radial"){
  82. theme.series.fill = dojox.gfx.gradutils.reverse(theme.series.fill);
  83. }
  84. return theme;
  85. };
  86. })();
  87. }