Menu

#3 function to manually set line color

open
nobody
5
2007-09-23
2007-09-23
Gordon
No

Manually specify line color with the addLine and addCurve methods

wtLineChart.prototype.addCurve = function(ptList, _color)
{
if (ptList.length<3)
throw "wtLineChart::addCurve(): the length of ptList should be greater than or equal to 3";
if (_color.length<3)
throw "wtLineChart::addCurve(): color should be a string greater than or equal to 3";
this.add("curve",ptList,_color);
}

also modified private function .add

wtLineChart.prototype.add = function(_type,ptList,_color)
{
var domNode = $_(this);

// if user passed a color string, either grab an autogenerated color
// or store the user color as a wtColor object in the color array
if (_color=="auto" || _color=="")
{
var color = domNode.colorGen.colorArray[domNode.path_.length].toString();
}
else
{
var color = _color;
domNode.colorGen.colorArray[domNode.path_.length] = new wtColor(_color);
}

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.