databar.lzx
<library>
<include href="extensions/drawview.lzx"/>
<class name="databar" extends="drawview">
<attribute name="tooltip" type="string" value="
"/>
<attribute name="style" type="string"/>
<strokestyle name="strokeDataBar"/>
<handler name="onmouseover">
if(tooltip != null && parent.parent.datatipEnabled){
parent.parent.datatooltip.style = this.style.tip;
parent.parent.datatooltip.show(tooltip);
}
</handler>
<handler name="onmouseout">
parent.parent.datatooltip.hide();
</handler>
<text name="txt"/>
<method name="setText" args="t">
txt.setAttribute('text', t);
</method>
<method name="render">
var borderWidth = 0;
if (parent.parent.databorderEnabled) {
if((style["line"] != null))
{
borderWidth = style.line.size;
this.strokeDataBar.setAttribute( "strokeColor", style.line.color );
this.strokeDataBar.setAttribute( "strokeWidth", borderWidth );
this.strokeDataBar.setAttribute( "strokeType", style.line.type);
this.strokeDataBar.globalAlpha = style.line.opacity;
}
}
if( parent.constructor.tagname == "barchartplotarea" ) {
if (parent.parent.databorderEnabled) {
this.renderBorder(width, - borderWidth,
1 + borderWidth / 2, height - 1 );
}
this.drawRect(width - borderWidth / 2, - borderWidth - 1,
1 + borderWidth, height );
}
else if( style.region.image != null ) {
this.setSource( style.region.image );
this.setAttribute( "stretches", style.region.stretches );
this.setAttribute('opacity', style.region.opacity);
}
else if( parent.constructor.tagname == "columnchartplotarea" ) {
if (parent.parent.databorderEnabled) {
this.renderBorder(borderWidth / 2, borderWidth/2,
width - 1 - borderWidth / 2, height - 1 - borderWidth / 2);
}
this.drawRect(borderWidth, borderWidth/2,
width - 1 - borderWidth, height );
}
if( style.region.gradient != null ) {
var g = null;
if( style.region.gradient == "linear" ) {
g = this.createLinearGradient(0, 0, this.width, this.height);
} else if ( this.style.region.gradient == "radial" ) {
g = this.createRadialGradient(0, 0,
.7, this.width, this.height, 0);
}
if( g != null ) {
this.globalAlpha = 0;
g.addColorStop(0, 0x000000);
this.globalAlpha = 1;
g.addColorStop(1, style.region.color);
this.fillStyle = g;
}
}
if (style.region.gradient == "none" || style.region.gradient == null) {
this.fillStyle = style.region.color;
}
this.globalAlpha = style.region.opacity;
this.fill();
</method>
<method name="drawRect" args="startx, starty, endx, endy">
this.beginPath();
this.moveTo(startx, starty);
this.lineTo(endx, starty);
this.lineTo(endx, endy);
this.lineTo(startx, endy);
this.lineTo(startx, starty);
</method>
<method name="renderBorder" args="startx, starty, endx, endy">
this.strokeDataBar.clear();
this.strokeDataBar.renderStroke(startx, starty, endx, starty);
this.strokeDataBar.renderStroke(endx, starty, endx, endy);
this.strokeDataBar.renderStroke(endx, endy, startx, endy);
this.strokeDataBar.renderStroke(startx, endy, startx, starty);
</method>
<handler name="onMouseDown">
parent.onMouseDown.sendEvent();
</handler>
</class>
</library>
Cross References
Includes
Classes
- <class name="databar" extends="drawview">