// o---------------------------------------------------------------------------------o // | This file is part of the RGraph package - you can learn more at: | // | | // | https://www.rgraph.net/license.html | // | | // | RGraph is dual-licensed under the Open Source GPL license. That means that it's | // | free to use and there are no restrictions on what you can use RGraph for! | // | If the GPL license does not suit you however, then there's an inexpensive | // | commercial license option available. See the URL above for more details. | // o---------------------------------------------------------------------------------o RGraph = window.RGraph || {isrgraph:true,isRGraph:true,rgraph:true}; RGraph.SVG = RGraph.SVG || {}; RGraph.SVG.HTML = RGraph.SVG.HTML || {}; // Module pattern (function (win, doc, undefined) { // // Draws the graph key (used by various graphs) // // @param object obj The graph object // @param array key An array of the texts to be listed in the key // @param colors An array of the colors to be used // RGraph.SVG.drawKey = function (obj) { var properties = obj.properties, key = properties.key, colors = properties.keyColors || properties.colors, defaultFont = 'Arial', blobSize = 0, width = 0, keyColorShape = properties.keyColorShape; // Work out the center point of the SVG tag var centerx = obj.svg.getAttribute('width') / 2; // If we're drawing a key on a funnel then work out the center of // the chart differently. This may be useful to other chart types // too if (obj.type === 'funnel') { centerx = (obj.graphWidth / 2) + properties.marginLeft; } // Loop thru the key and draw them if (key && key.length) { // First measure the length so that the key can be centered for (var i=0,length = 0; i'; // // Add the individual key elements // for (var i=0; i ' + (properties.links && properties.links[i] ? '' : '') + '' + properties.labels[i] + '' + (properties.links && properties.links[i] ? '' : '') + ''; } div.innerHTML += (str + ''); for (var i=0; i