/* Copyright (c) 2004-2006, The Dojo Foundation All Rights Reserved. Licensed under the Academic Free License version 2.1 or above OR the modified BSD license. For more information on Dojo licensing, see: http://dojotoolkit.org/community/licensing.shtml */ dojo.provide("dojo.charting.PlotArea"); dojo.require("dojo.lang.common"); dojo.require("dojo.gfx.color"); dojo.require("dojo.gfx.color.hsl"); dojo.require("dojo.charting.Plot"); dojo.charting.PlotArea = function(){ // summary // Creates a new PlotArea for drawing onto a Chart. var id="dojo-charting-plotarea-"+dojo.charting.PlotArea.count++; this.getId=function(){ return id; }; this.setId=function(key){ id = key; }; this.areaType = "standard"; // standard || radar this.plots = []; // plots that will be drawn on this area this.size={ width:600, height:400 }; this.padding={ top:10, right:10, bottom:20, left:20 }; // drawing node references. this.nodes = { main:null, area:null, background: null, axes: null, plots: null }; // this is preset for a limited color range (green to purple), // anticipating a max of 32 series on this plot area. // if you need more flexibility, override these numbers. this._color = { h: 140, s: 120, l: 120, step: 27 }; }; dojo.charting.PlotArea.count = 0; dojo.extend(dojo.charting.PlotArea, { nextColor: function(){ // summary // Advances the internal HSV cursor and returns the next generated color. var rgb=dojo.gfx.color.hsl2rgb(this._color.h, this._color.s, this._color.l); this._color.h = (this._color.h + this._color.step)%360; while(this._color.h < 140){ this._color.h += this._color.step; } return dojo.gfx.color.rgb2hex(rgb[0], rgb[1], rgb[2]); // string }, getArea:function(){ // summary // Return an object describing the coordinates of the available area to plot on. return { left: this.padding.left, right: this.size.width - this.padding.right, top: this.padding.top, bottom: this.size.height - this.padding.bottom, toString:function(){ var a=[ this.top, this.right, this.bottom, this.left ]; return "["+a.join()+"]"; } }; // object }, getAxes: function(){ // summary // get the unique axes for this plot area. var axes={}; for(var i=0; i 0){ node.removeChild(node.childNodes[0]); } this.nodes[p]=null; } } }); dojo.requireIf(dojo.render.svg.capable, "dojo.charting.svg.PlotArea"); dojo.requireIf(dojo.render.vml.capable, "dojo.charting.vml.PlotArea");