[jboss-cvs] jboss-profiler/java/webapp/lps/components/charts/common ...
Takuro Okada
t2-okada at nri.co.jp
Thu Oct 26 05:00:55 EDT 2006
User: tokada
Date: 06/10/26 05:00:55
Added: java/webapp/lps/components/charts/common Tag:
JBossProfiler_Expansion axis.lzx
rectangularchart.lzx chart.lzx verticalaxis.lzx
Log:
Revision Changes Path
No revision
No revision
1.1.2.1 +562 -0 jboss-profiler/java/webapp/lps/components/charts/common/Attic/axis.lzx
(In the diff below, changes in quantity of whitespace are not shown.)
Index: axis.lzx
===================================================================
RCS file: axis.lzx
diff -N axis.lzx
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ axis.lzx 26 Oct 2006 09:00:55 -0000 1.1.2.1
@@ -0,0 +1,562 @@
+<library>
+ <include href="../styles/strokestyle.lzx"/>
+ <include href="../common/label.lzx"/>
+ <include href="../common/tickmarklabel.lzx"/>
+
+ <!--- A abstract class that represents one of the axes of a rectangular chart. In general, axis isn't instantiated directly
+ -->
+ <class name="axis" extends="drawview">
+ <!--- Data Column that is used to override the values of Tic Marks labels -->
+ <attribute name="ticklabelcolumn" value="$once{''}" type="string"/>
+ <!--- Indicates the axis type can be 'linear' or 'categorical' -->
+ <attribute name="type" type="string" />
+ <!--- Indicates the interval of values between the tic marks of the axis -->
+ <attribute name="interval" value="null" />
+ <!--- Indicates the column name associated to the axis -->
+ <attribute name="columnName" type="string" />
+ <!--- @keyword private -->
+ <attribute name="dataSeries" value="[]" />
+ <!--- enable or disable the axis -->
+ <attribute name="axisEnabled" type="boolean" value="true" />
+ <!--- @keyword private -->
+ <attribute name="categoricalArray" value="null" />
+ <!--- @keyword private -->
+ <attribute name="ratioPixel" type="number" />
+ <!--- @keyword private -->
+ <attribute name="scale" type="number" value="1"/>
+ <!--- @keyword private -->
+ <attribute name="offset" type="number" value="0"/>
+ <!--- @keyword private -->
+ <attribute name="tickmarkLabelMaxDecimals" type="number" value="2"/>
+
+ <!--- Attribute that controls if the labels are vertically repositioned to avoid overlaping -->
+ <attribute name="labelReposEnabled" type="boolean" value="true"/>
+
+ <!-- Major and Minor tickmarks attributes -->
+ <!--- enable Major Tics Marks -->
+ <attribute name="majorTickEnabled" type="boolean" value="true"/>
+ <!--- enable minor Tics Marks -->
+ <attribute name="minorTickEnabled" type="boolean" value="false"/>
+ <!--- Allows to customize the interval of the Major Tics Marks-->
+ <attribute name="majorInterval" type="number" value="5"/>
+
+ <!-- Begin Axis title attributes -->
+ <!--- Indicates the placement of the Axis title possible values: 'low','high','default'-->
+ <attribute name="titleLocation" type="string" value="default"/>
+ <!--- Axis title label-->
+ <attribute name="title" type="string"/>
+ <!--- Indicates the placement in X position of the Axis title -->
+ <attribute name="titleX" type="number" value="null"/>
+ <!--- Indicates the placement in Y position of the Axis title -->
+ <attribute name="titleY" type="number" value="null"/>
+ <!--- @keyword private -->
+ <attribute name="titleGap" type="number" value="10"/>
+ <!-- End Axis title attributes -->
+
+ <!--- Exposes distances where tickmarks are drawn
+ @keyword private -->
+ <attribute name="tickMarkPositions" value="[]"/>
+
+ <!--- Exposes distances where tickmarks are drawn
+ @keyword private -->
+ <attribute name="labelTextArray" value="[]"/>
+
+ <!--- @keyword private -->
+ <attribute name="labelArray" value="[]"/>
+
+ <!-- Begin Axis Tick Marks Attributes -->
+ <!--- Numerical value that indicates the Minimum value in the axis can be positive or negative value -->
+ <attribute name="minimum" value="null"/>
+ <!--- Numerical value that indicates the Maximum value in the axis can be positive or negative value -->
+ <attribute name="maximum" value="null"/>
+ <!-- Attributes that represent the boundaries of the values that can
+ be rendered. -->
+ <!--- @keyword private -->
+ <attribute name="minimumRender" type="number" value="0"/>
+ <!--- @keyword private -->
+ <attribute name="maximumRender" type="number" value="0"/>
+
+ <!--- @keyword private -->
+ <attribute name="adjustmin" value="false" />
+ <!--- enable the rendering of tic Marks labels -->
+ <attribute name="tickMarksLabelsEnabled" type="boolean" value="true"/>
+ <!--- Indicates the axis title rotation can be 'horizontal' or 'vertical' -->
+ <attribute name="labelrotation" type="string" value="horizontal"/>
+ <!--- @keyword private -->
+ <viewspool name="_labelspool" parentview="${parent}" viewclass="tickmarklabel"/>
+
+ <!--- Fix the range of the axis to the maximum & minimum -->
+ <attribute name="fixedRange" value="false" type="boolean"/>
+
+ <!--- @keyword private -->
+ <view name="tickMarksView"/>
+ <!--- End Axis Tick Marks Attributes-->
+ <!--- @keyword private -->
+ <strokestyle name="objStroke" />
+ <!--- @keyword private -->
+ <label name="titleView" />
+ <!--- Render ticks
+ @keyword private -->
+ <method name="renderTick"> <![CDATA[
+ if (type.toUpperCase()=='CATEGORICAL') {
+ renderCategoricalTick();
+ } else if (type.toUpperCase()=='LINEAR') {
+ renderLinearTick();
+ }
+ ]]>
+ </method>
+ <!--- Method for extensible label rendering
+ @param string pLabel : a label text -->
+ <method name="processData" args="pLabel">
+ return pLabel;
+ </method>
+
+ <!--- Method to return a pixel position given graph data
+ @param Number pInput : for linear charts a graphicable data.
+ @keyword private
+ -->
+ <method name="getPixelDistance" args="pInput"/>
+
+ <!--- Returns the distances for where tickmarks will be drawn
+ @keyword private -->
+ <method name="getTickMarkPositions">
+ <![CDATA[
+ return this.tickMarkPositions;
+ ]]>
+ </method>
+
+ <!--- Actually render tickmarks and tickmark labels
+ @param Number pTickyoff : tickmark offset from the axis
+ @keyword private-->
+ <method name="renderCycle" args="pTickyoff">
+ <![CDATA[
+
+ if (this.tickMarkPositions!=null && this.tickMarkPositions.length > 0 ) {
+ for(var i=0;i<this.tickMarkPositions.length;i++)
+ {
+ var distance = this.tickMarkPositions[i];
+
+ if ( this.minorTickEnabled && i>0 && this.majorInterval!=null && this.majorInterval>0 ) {
+ //get the previous tickmark
+ var lPrevDistance = this.tickMarkPositions[i-1];
+ var lMinorDistance = (distance - lPrevDistance)/(this.majorInterval);
+ for( var j=1; j<(this.majorInterval) ;j++) {
+ renderTickMark(pTickyoff-this.style.tickminor.length,lPrevDistance+Math.round(lMinorDistance*j), this.style.tickminor);
+ }
+ }
+
+ //render the tick mark
+ if ( this.majorTickEnabled ) {
+ renderTickMark(pTickyoff,distance,this.style.tickmajor);
+ }
+
+ //if enabled
+ if(this.tickMarksLabelsEnabled) {
+ renderTickMarkLabel(this.labelTextArray[i],distance,pTickyoff,i);
+ }
+ }
+ }
+ ]]>
+ </method>
+
+ <!--- Init method
+ @keyword private-->
+ <method name="init">
+ this.setupDelegate();
+ super.init();
+ </method>
+
+ <!--- setupDelegate
+ @keyword private-->
+ <method name="setupDelegate">
+ this.del = new LzDelegate(this, "setScaleAndOffset");
+ this.del.register(this, "onheight");
+ this.del.register(this, "onminimum");
+ this.del.register(this, "onmaximum");
+ </method>
+
+ <!--- clear
+ @keyword private -->
+ <method name="clear">
+ super.clear();
+ objStroke.clear();
+ _labelspool.reclaimAll();
+ </method>
+
+ <!--- setAxisTitleAttributes
+ @keyword private -->
+ <method name="setAxisTitleAttributes">
+ this.titleView.setAttribute('style', this.style.label);
+ this.titleView.render(this.title);
+ </method>
+
+ <!--- Render axis title
+ @keyword private -->
+ <method name="renderTitle">
+ </method>
+
+ <!---
+ Get the length of the axis.
+ @keyword private -->
+ <method name="getAxisLength"/>
+
+ <!--- Render categorical tick marks
+ @keyword private -->
+ <method name="renderCategoricalTick">
+ <![CDATA[
+ //Number of tickmarks
+
+ //Make sure max and min are integers
+ maximumRender = Math.round(maximumRender);
+ minimumRender = Math.round(minimumRender);
+
+ var lTickMarks = (maximumRender - minimumRender) + 1;
+
+ if(lTickMarks>0){
+
+ var lTickmarkSpace = 0;
+
+ //determine ratio
+ lTickmarkSpace = getAxisLength() / lTickMarks;
+
+ //determine offset
+ var tickyoff = 0;
+ if(this.style.tickmajor.position == 'outside') {
+ tickyoff = this.style.tickmajor.length;
+ } else if(this.style.tickmajor.position == 'across') {
+ tickyoff = (this.style.tickmajor.length/2);
+ }
+
+ this.labelArray = new Array(lTickMarks);
+
+ //Setup position array
+ this.tickMarkPositions = new Array(lTickMarks);
+ this.labelTextArray = new Array(lTickMarks);
+
+ //Fill the distance array
+ var lArrayIndex = 0;
+
+ for(var i=minimumRender;i<(maximumRender+1);i++)
+ {
+ this.tickMarkPositions[lArrayIndex] = Math.round((lArrayIndex*lTickmarkSpace) + (lTickmarkSpace/2)) ;
+ this.labelTextArray[lArrayIndex] = this.categoricalArray[i];
+ lArrayIndex++;
+ }
+
+// HACK begin
+ if(this.ticklabelcolumn != ""){
+ useLabelColumns();
+ }
+// HACK end
+ //Do the actual render
+ renderCycle(tickyoff);
+
+ //Reposition labels if enabled
+ if(tickMarksLabelsEnabled && this.labelReposEnabled) {
+ reposLabels(lTickMarks);
+ }
+
+ }
+ ]]>
+ </method>
+ <!--- Adjust the minimum value to cero if attribute is true
+ @keywords private -->
+ <method name="adjustMinimum">
+ <![CDATA[
+ if(minimumRender >= 0 && maximumRender >= 0) {
+ minimumRender = 0;
+ } else if(minimumRender <= 0 && maximumRender <= 0) {
+ maximumRender = 0;
+ }
+ ]]>
+ </method>
+ <!--- Calculate an adecuate range to have 5-10 tickmarks
+ @param Number pRange: range on what to find a good interval
+ @keywords private -->
+ <method name="calculateAutomaticInterval" args="pRange"> <![CDATA[
+ var lRetValue=1;
+ var lCanonicalInterval = pRange * 0.1;
+
+ if( pRange < 1) {
+ do {
+ lRetValue = lRetValue/10;
+ }while(lRetValue > lCanonicalInterval);
+
+ while(lRetValue * 2 < lCanonicalInterval) {
+ lRetValue = lRetValue*2;
+ }
+ } else {
+ do {
+ lRetValue = lRetValue * 10;
+ } while(lRetValue <= lCanonicalInterval);
+
+ while(lRetValue / 2 > lCanonicalInterval) {
+ lRetValue = lRetValue / 2;
+ }
+ }
+
+ return lRetValue;
+ ]]>
+ </method>
+ <!--- Find the outside border value using the interval
+ @param Number pNum: nombre to overcome
+ @param Number pInt: interval.
+ @param Boolean pMinMax: true if this value is a maximum.
+ @keywords private -->
+ <method name="findOutsideBorder" args="pNum,pInt,pMinMax"> <![CDATA[
+ var lRetValue = 0;
+// HACK begin
+ if(pMinMax) {
+ lRetValue = Math.ceil(pNum/pInt) * pInt;
+ }else {
+ lRetValue = Math.floor(pNum/pInt) * pInt;
+ }
+ /*
+ if(pMinMax) {
+ if(pNum >= 0) {
+ while(lRetValue < pNum){
+ lRetValue += pInt;
+ }
+ } else {
+ while((lRetValue-pInt) > pNum) {
+ lRetValue -= pInt;
+ }
+ }
+ } else {
+ if(pNum >= 0) {
+ while((lRetValue+pInt) < pNum){
+ lRetValue += pInt;
+ }
+ } else {
+ while(lRetValue > pNum){
+ lRetValue -= pInt;
+ }
+ }
+ }
+ */
+// HACK end
+ return lRetValue;
+ ]]> </method>
+
+ <!--- Render a tick mark
+ @param Number pOffset : displacement depending on the position of the tickmark
+ @param Number pPos : actual tickmark position along the axis
+ @param expression pStyle : tickmark style object to use on the render
+ @keywords private -->
+ <method name="renderTickMark" args="pOffset,pPos,pStyle"/>
+
+ <!--- Set label position
+ @keywords private -->
+ <method name="setLabelPos" args="pLabel,pOffset,pTW,pTH,pPos"/>
+
+ <!--- Render a tickmark label
+ @keywords private -->
+ <method name="renderTickMarkLabel"
+ args="pLabel,pPos,pOffset,pI"> <![CDATA[
+ //create label and set text
+ var lLabel = _labelspool.getView();
+ var lHeight=0;
+ var lWidth=0;
+
+ //set the font style
+ lLabel.style=this.style.tickmajor.label;
+ lLabel.render(processData(pLabel));
+
+ //Process orientation
+ var lTW = 0;
+ var lTH = 0;
+
+ lTW = lLabel.getTextWidth();
+ lTH = lLabel.getTextHeight();
+ this.setLabelPos(lLabel,pOffset,lTW,lTH,pPos);
+
+ //add label to array
+ this.labelArray[pI] = lLabel;
+ ]]>
+ </method>
+
+ <!--- Check label location and change placement to avoid labels
+ overlaping
+ @keywords private -->
+ <method name="reposLabels" args="pMarks"/>
+
+ <!--- Calculate automatic outside borders
+ @param Number pMin : minimum data to be rendered
+ @param Number pMax : maximum data to be rendered
+ @keyword private -->
+ <method name="setAutomaticMinMaxRender" args="pMin, pMax">
+ if( !this.fixedRange ) {
+ this.minimum = pMin;
+ this.maximum = pMax;
+ } else {
+ if( typeof( this.minimum ) == "undefined" ) {
+ this.minimum = pMin;
+ }
+
+ if( typeof( this.maximum ) == "undefined" ) {
+ this.maximum = pMax;
+ }
+ }
+
+ //Find graphic data range
+ var lRange = this.maximum - this.minimum;
+
+
+ //If interval is not defined, calculate one
+ if( this.interval == null ) {
+ this.interval = calculateAutomaticInterval(lRange);
+ }
+
+ //Find the data ending and starting points of the plot area
+ this.minimumRender = findOutsideBorder(this.minimum,interval,false);
+ this.maximumRender = findOutsideBorder(this.maximum,interval,true);
+ </method>
+
+ <!--- Render linear ticks
+ @keyword private -->
+ <method name="renderLinearTick">
+ <![CDATA[
+ //First adjust min and max if adjustmin attribute is present
+ if(this.adjustmin) {
+ adjustMinimum();
+ }
+
+ //Determine how many marks we need
+ var lMarks = Math.floor((Math.abs(this.minimumRender-this.maximumRender))/this.interval) + 1;
+ //determine total graph area
+ var lGA = Math.abs(this.minimumRender - this.maximumRender);
+
+ var lRatio = 0;
+
+ //determine ratio
+ lRatio = (this.getAxisLength() / lGA);
+
+ //Set the ratioPixel
+ ratioPixel = lRatio * interval;
+
+ //Array to store the labels
+ this.labelArray = new Array(lMarks);
+
+ //determine offset
+ var tickyoff = 0;
+
+ if(this.style.tickmajor.position == 'outside') {
+ tickyoff = this.style.tickmajor.length;
+ } else if(this.style.tickmajor.position == 'across') {
+ tickyoff = (this.style.tickmajor.length/2);
+ }
+
+ //Setup position array
+ this.tickMarkPositions = new Array(lMarks);
+ this.labelTextArray = new Array(lMarks);
+
+ //Fill the distance array
+ for(var i=0;i<lMarks;i++)
+ {
+ this.tickMarkPositions[i] = Math.round(i*ratioPixel);
+ this.labelTextArray[i] = ( i * this.interval ) + this.minimumRender;
+ this.labelTextArray[i] = trunDec((( i * this.interval ) + this.minimumRender),this.tickmarkLabelMaxDecimals);
+ }
+
+ if(this.ticklabelcolumn != ""){
+ useLabelColumns();
+ }
+
+ //Do the actual render
+ renderCycle(tickyoff);
+
+ //Reposition labels if enabled
+ if(tickMarksLabelsEnabled && this.labelReposEnabled) {
+ reposLabels(lMarks);
+ }
+ ]]>
+ </method>
+ <!---
+ This method replaces the array labels with an array from a Data Column
+ @keyword private -->
+ <method name="useLabelColumns">
+ <![CDATA[
+ //Using useLabelColumns
+ //Perform validations
+ if(this.labelTextArray!=null && dataSeries!=null && dataSeries[0]!=null && dataSeries[0].getDataColumn(this.ticklabelcolumn).values!=null && this.labelTextArray.length==dataSeries[0].getDataColumn(this.ticklabelcolumn).values.length) {
+ this.labelTextArray = dataSeries[0].getDataColumn(this.ticklabelcolumn).values;
+ }
+ ]]>
+ </method>
+ <!--- setter for data series
+ @param expression dataSeries: dataSeries to set to the Axis.
+ @keyword private -->
+ <method name="setDataSeries" args="dataseries">
+ this.setAttribute('dataSeries', dataseries);
+ </method>
+
+
+ <!--- setter for scale and offset
+ @keyword private -->
+ <method name="setScaleAndOffset">
+ </method>
+
+ <!--- setter for plot area
+ @keyword private -->
+ <method name="setPlotArea" args="plotarea">
+ this.setAttribute('plotarea', plotarea);
+ </method>
+
+ <!--- Render axis
+ @keyword private -->
+ <method name="renderAxis">
+ </method>
+
+ <!--- Render method render Axis Title, Axis lines, Tic Marks and TickMarks labels
+ -->
+ <method name="render" > <![CDATA[
+ this.objStroke.setAttribute('strokeColor', this.style.axisline.color);
+ this.objStroke.setAttribute('strokeType', this.style.axisline.type);
+ this.objStroke.setAttribute('strokeWidth', this.style.axisline.size);
+ this.objStroke.setAttribute('opacity', this.style.axisline.opacity);
+
+ this.setVisible(axisEnabled);
+ setAxisTitleAttributes();
+ renderAxis();
+ renderTick();
+ renderTitle();
+ ]]>
+ </method>
+
+ <!--- Allow to set the minimumRender and the maximumRender attributes manually
+ @keyword private -->
+ <method name="setNewMinMaxRenderer" args="pNewMin, pNewMax">
+ this.minimumRender = pNewMin;
+ this.maximumRender = pNewMax;
+ </method>
+
+ <!--- Truncate decimals
+ @param Number pNum: input number
+ @param Number pDec: number of decimals to leave
+ @keyword private -->
+ <method name="trunDec" args="pNum,pDec">
+ <![CDATA[
+ var lNum = pNum + "";
+ if (lNum.indexOf('.')!=-1 && pDec>-1) {
+ if ( pDec==0 ) {
+ return lNum.substring(0,lNum.indexOf('.'));
+ }
+ var lRem = lNum.substring(lNum.indexOf('.')+1,lNum.length);
+ if (lRem.length > pDec) {
+ lRem = lRem.substring(0,pDec);
+ }
+ return lNum.substring(0,lNum.indexOf('.'))+"."+lRem;
+ }
+ return pNum;
+ ]]>
+ </method>
+
+</class>
+</library>
+<!-- * X_LZ_COPYRIGHT_BEGIN
+***************************************************
+* Copyright 2001-2005 Laszlo Systems, Inc. All Rights Reserved.
+* Use is subject to license terms.
+* X_LZ_COPYRIGHT_END
+****************************************************** -->
+<!-- @LZX_VERSION@ -->
1.1.2.1 +570 -0 jboss-profiler/java/webapp/lps/components/charts/common/Attic/rectangularchart.lzx
(In the diff below, changes in quantity of whitespace are not shown.)
Index: rectangularchart.lzx
===================================================================
RCS file: rectangularchart.lzx
diff -N rectangularchart.lzx
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ rectangularchart.lzx 26 Oct 2006 09:00:55 -0000 1.1.2.1
@@ -0,0 +1,570 @@
+<library>
+ <include href="chart.lzx"/>
+ <include href="horizontalaxis.lzx"/>
+ <include href="verticalaxis.lzx"/>
+ <!--- class that provides all common features for the rectangular charts like line, bar and column -->
+ <class name="rectangularchart" extends="chart" clip="true">
+
+ <!--- The minimum virtual value to be rendered in the 'x' axis -->
+ <attribute name="minx" type="number" value="0"/>
+ <!--- The maximum virtual value to be rendered in the 'x' axis -->
+ <attribute name="maxx" type="number" value="0"/>
+ <!--- The minimum virtual value to be rendered in the 'y' axis -->
+ <attribute name="miny" type="number" value="0"/>
+ <!--- The maximum virtual value to be rendered in the 'y' axis -->
+ <attribute name="maxy" type="number" value="0"/>
+
+ <!-- The default min's ans max's values that belongs to all the data series -->
+ <attribute name="defaultminx" type="number" value="0"/>
+ <attribute name="defaultmaxx" type="number" value="0"/>
+ <attribute name="defaultminy" type="number" value="0"/>
+ <attribute name="defaultmaxy" type="number" value="0"/>
+
+ <!--- @keyword private -->
+ <attribute name="dataSeriesLeaf" type="expression" value="${null}"/>
+
+ <!--- Determines if the vertical grid lines are going to be used -->
+ <attribute name="verticalGridLines" type="boolean" value="false"/>
+
+ <!--- Determines if the horizontal grid lines are going to be used -->
+ <attribute name="horizontalGridLines" type="boolean" value="false"/>
+
+ <!--- @keyword private -->
+ <attribute name="gridlinecolor" />
+
+ <!--- @keyword private -->
+ <method name="setHAxisMin">
+ this.haxis.minimumRender = this.minx;
+ </method>
+
+ <!--- @keyword private -->
+ <method name="setHAxisMax">
+ this.haxis.maximumRender = this.maxx;
+ </method>
+
+ <!--- @keyword private -->
+ <method name="setVAxisMin">
+ this.vaxis.minimumRender = this.miny;
+ </method>
+ <!--- @keyword private -->
+ <method name="setVAxisMax">
+ this.vaxis.maximumRender = this.maxy;
+ </method>
+
+ <!--- Draw the grid lines
+ @keyword private -->
+ <method name="renderGridLines">
+ <![CDATA[
+ if ( this.verticalGridLines ){
+ this.renderVerticalGridlines();
+ }
+
+ if ( this.horizontalGridLines ) {
+ this.renderHorizontalGridlines();
+ }
+ ]]>
+ </method>
+
+ <!-- Render vertical grid lines
+ @keyword private -->
+ <method name="renderVerticalGridlines">
+ <![CDATA[
+ if ( haxis.getTickMarkPositions()!=null && haxis.getTickMarkPositions().length > 0 ) {
+
+ haxis.strokeStyle = this.style.vaxisstyle.gridline.color;
+ haxis.lineWidth = this.style.vaxisstyle.gridline.size;
+ haxis.globalAlpha = this.style.vaxisstyle.gridline.opacity;
+ haxis.fill();
+
+ for ( var i=0; i < haxis.getTickMarkPositions().length ; i++ ) {
+ haxis.beginPath();
+ haxis.moveTo(haxis.getTickMarkPositions()[i], 0 );
+ haxis.lineTo(haxis.getTickMarkPositions()[i], -(vaxis.height) );
+ haxis.stroke();
+ }
+ }
+ ]]>
+ </method>
+
+ <!-- Render horizontal grid lines
+ @keyword private -->
+ <method name="renderHorizontalGridlines">
+ <![CDATA[
+ if ( vaxis.getTickMarkPositions()!=null && vaxis.getTickMarkPositions().length > 0 ) {
+
+ vaxis.strokeStyle = this.style.haxisstyle.gridline.color;
+ vaxis.lineWidth = this.style.haxisstyle.gridline.size;
+ vaxis.globalAlpha = this.style.haxisstyle.gridline.opacity;
+ vaxis.fill();
+
+ for ( var i=0; i < vaxis.getTickMarkPositions().length ; i++ ) {
+ vaxis.beginPath();
+ vaxis.moveTo(0, vaxis.getTickMarkPositions()[i] );
+ vaxis.lineTo(haxis.width, vaxis.getTickMarkPositions()[i] );
+ vaxis.stroke();
+ }
+ }
+ ]]>
+ </method>
+
+ <!--- render the chart -->
+ <method name="render">
+ <![CDATA[
+// HACK begin
+ //var startTime = (new Date()).getTime();
+// HACK end
+ this.renderAxis();
+ this.adjustAxesToLayout();
+ this.renderPlotArea();
+ this.renderGridLines();
+
+ if (this.valuelinesenabled) {
+ this.renderValueLine();
+ }
+
+ if (this.valuepointsenabled) {
+ this.renderValuePoint();
+ }
+
+ if (this.valueregionsenabled) {
+ this.renderValueRegion();
+ }
+
+ this.applyBGStyle( this.style.chartbgstyle );
+ haxis.sendBehind(plotarea);
+ vaxis.sendBehind(plotarea);
+// HACK begin
+ //Debug.write("render time: " + (((new Date()).getTime() - startTime) / 1000) + " seconds");
+// HACK end
+ ]]>
+ </method>
+
+ <!--- render the axis
+ @keyword private -->
+ <method name="renderAxis">
+ <![CDATA[
+ vaxis.clear();
+ vaxis.setDataSeries(this.dataSeriesLeaf);
+
+ if ( this.style.vaxisstyle!=null ) {
+ vaxis.style = this.style.vaxisstyle;
+ } else {
+ vaxis.style = new axisstyle();
+ }
+
+ vaxis.setX( (this.plotarea[x] != null ? this.plotarea.x : this.x) );
+ vaxis.setY( (this.plotarea[y] != null ? this.plotarea.y : this.y) );
+ vaxis.setHeight( (this.plotarea[height] != null ? this.plotarea.height : this.height) );
+
+ vaxis.render();
+
+ haxis.clear();
+ haxis.setDataSeries(this.dataSeriesLeaf);
+
+ if ( this.style.haxisstyle!=null ) {
+ haxis.style = this.style.haxisstyle;
+ } else {
+ haxis.style = new axisstyle();
+ }
+
+ haxis.setX( (this.plotarea[x] != null ? this.plotarea.x : this.x) );
+ haxis.setY( (this.plotarea[y] != null && this.plotarea[height] != null ?
+ this.plotarea.y + this.plotarea.height : this.y + this.height) );
+ haxis.setWidth( (this.plotarea[width] != null ? this.plotarea.width : this.width) );
+
+ haxis.render();
+ ]]>
+ </method>
+
+ <!--- @keyword private -->
+ <method name="renderValueLine">
+ <![CDATA[
+ var valueLines = this.getNodesOfClass("valueline");
+ for(var i = 0; i < valueLines.length; i++){
+ valueLines[i].render();
+ }
+ ]]>
+ </method>
+
+ <method name="renderValuePoint">
+ <![CDATA[
+ var valuePoints = this.getNodesOfClass("valuepoints");
+ for(var i = 0; i < valuePoints.length; i++){
+ valuePoints[i].render();
+ }
+ ]]>
+ </method>
+
+ <!--- Render the value regions defined in the chart
+ @keyword private -->
+ <method name="renderValueRegion">
+ <![CDATA[
+ var valueRegions = this.getNodesOfClass("valueregion");
+ for(var i = 0; i < valueRegions.length; i++){
+ valueRegions[i].sendBehind();
+ valueRegions[i].style = this.style.valueregionstyle;
+ valueRegions[i].render();
+ }
+ ]]>
+ </method>
+
+ <!--- Adjust the plot area to the dimensions of the chart and the
+ axes. This method overrides chart.adjustPlotAreaToLayout()
+ @keyword private -->
+ <method name="adjustPlotAreaToLayout">
+ <![CDATA[
+ if( this.plotarea != null ) {
+ this.plotarea.setAttribute( "width", haxis.width );
+ this.plotarea.setAttribute( "height", vaxis.height );
+
+ this.plotarea.setAttribute( "x", (vaxis.x + vaxis.width) );
+ this.plotarea.setAttribute( "y", vaxis.y );
+ }
+ ]]>
+ </method>
+ <!--- @keyword private -->
+ <method name="adjustAxesToLayout">
+ <![CDATA[
+ var overHeight = 0;
+ var overWidth = 0;
+
+ vaxis.clear();
+ overHeight = getAxisOverDimension("horizontal");
+ if( (vaxis.height + overHeight + this.topMargin + this.bottomMargin) > this.height ) {
+ vaxis.setAttribute( "height", (this.height -
+ (overHeight + this.topMargin + this.bottomMargin) ) );
+ }
+
+ haxis.clear();
+ haxis.setRightMargin();
+ overWidth = getAxisOverDimension("vertical");
+ if( (haxis.width + overWidth + this.leftMargin + this.rightMargin) > this.width ) {
+ haxis.setAttribute( "width", (this.width -
+ (overWidth + this.leftMargin + this.rightMargin) ) );
+ }
+
+ vaxis.setX( overWidth + this.leftMargin );
+ vaxis.setY( this.topMargin );
+ vaxis.render();
+
+ haxis.setX( overWidth + this.leftMargin );
+ haxis.setY( (vaxis.y + vaxis.height) );
+ haxis.render();
+ ]]>
+
+ </method>
+
+ <!--- @keyword private -->
+ <method name="getAxisOverDimension" args="axis">
+ <![CDATA[
+ if( axis == "horizontal" ) {
+ // Tests horizontal axis with axis title below the axis line.
+ if( haxis != null ) {
+
+ if( haxis.columnName == 'x' && haxis.titleLocation == "low" )
+ return (haxis.height + haxis.tickMarksView.height +
+ 2*this.verticalGap + haxis.titleView.height);
+ else
+ return (haxis.height + haxis.tickMarksView.height + this.verticalGap);
+ }
+ }
+ else if( axis == "vertical" ) {
+ // Tests vertical axis with axis title at the left of the axis line.
+ if( vaxis != null ) {
+
+ if( vaxis.columnName == 'y' && vaxis.titleLocation == "low" )
+ return (vaxis.width + vaxis.tickMarksView.width +
+ 2*this.horizontalGap + vaxis.titleView.width);
+ else
+ return (vaxis.width + vaxis.tickMarksView.width + this.horizontalGap);
+ }
+ }
+
+ return 0;
+ ]]>
+ </method>
+
+ <!--- @keywords private
+ rerender a chart when new data come in -->
+ <method name="dataload">
+ this["haxis"] = this.getNodeOfClass("horizontalaxis");
+ this["vaxis"] = this.getNodeOfClass("verticalaxis");
+
+ this.dataSeriesLeaf = this.getDataSeries().getDataSeriesLeafs();
+
+ this.calcDefaultMinMax();
+ this.minx = this.defaultminx;
+ this.maxx = this.defaultmaxx;
+ this.miny = this.defaultminy;
+ this.maxy = this.defaultmaxy;
+
+ this.adjustOptimizeMinMax();
+ super.dataload();
+ </method>
+ <!--- @keyword private -->
+ <method name="adjustOptimizeMinMax">
+ if( haxis.type.toUpperCase() == 'LINEAR' ) {
+ haxis.setAutomaticMinMaxRender( this.minx, this.maxx );
+ this.setAttribute("minx", haxis.minimumRender);
+ this.setAttribute("maxx", haxis.maximumRender);
+ }
+
+ if( vaxis.type.toUpperCase() == 'LINEAR' ) {
+ vaxis.setAutomaticMinMaxRender( this.miny, this.maxy );
+ this.setAttribute("miny", vaxis.minimumRender);
+ this.setAttribute("maxy", vaxis.maximumRender);
+ }
+ </method>
+
+ <!--- Set the min and max to show all data
+ @keyword private -->
+ <method name="calcDefaultMinMax">
+ <![CDATA[
+ // Set the minx and maxx values based on the data series.
+ if( haxis.type.toUpperCase() == 'LINEAR' ) {
+ this.buildLinearMinMax( haxis, 'x' );
+ } else if( haxis.type.toUpperCase() == 'CATEGORICAL' ) {
+ this.buildCategoricalMinMax( haxis, 'x' );
+ }
+
+ // Set the miny and maxy values based on the data series.
+ if( vaxis.type.toUpperCase() == 'LINEAR' ) {
+ this.buildLinearMinMax( vaxis, 'y' );
+ } else if( vaxis.type.toUpperCase() == 'CATEGORICAL' ) {
+ this.buildCategoricalMinMax( vaxis, 'y' );
+ }
+ ]]>
+ </method>
+ <!--- @keyword private -->
+ <method name="buildLinearMinMax" args="pAxis, pOrientation">
+ <![CDATA[
+ var i = 0;
+ var column = null;
+ var singledataseriesmin = [];
+ var singledataseriesmax = [];
+
+ for (i = 0; i < this.dataSeriesLeaf.length; i++) {
+ //Get the a single data series from the array
+ column = this.dataSeriesLeaf[i].getDataColumn(pAxis.columnName);
+
+ //Get the mininum value of the single data series
+ singledataseriesmin.push(column.getMin());
+
+ //Get the maximum value of the single data series
+ singledataseriesmax.push(column.getMax());
+ }
+
+ //Set the minimum and maximum values for this axis.
+ if( pOrientation.toLowerCase() == 'x' ) {
+ this.defaultminx = findMin(singledataseriesmin);
+ this.defaultmaxx = findMax(singledataseriesmax);
+ } if( pOrientation.toLowerCase() == 'y' ) {
+ this.defaultminy = findMin(singledataseriesmin);
+ this.defaultmaxy = findMax(singledataseriesmax);
+ }
+ ]]>
+ </method>
+ <!--- @keyword private -->
+ <method name="buildCategoricalMinMax" args="pAxis, pOrientation">
+ //Categorical Axis - When the axis type is categorical, the axis class only expects one data serie
+ //The Axis minimun value is 0 and maximum value is the # of Categories -1 for the data serie.
+ pAxis.categoricalArray = this.dataSeriesLeaf[0].getDataColumn(pAxis.columnName).values;
+
+ //Set the minimum and maximum values for this axis.
+ if( pOrientation.toLowerCase() == 'x' ) {
+ this.defaultminx = 0;
+ this.defaultmaxx = pAxis.categoricalArray.length - 1;
+ } if( pOrientation.toLowerCase() == 'y' ) {
+ this.defaultminy = 0;
+ this.defaultmaxy = pAxis.categoricalArray.length - 1;
+ }
+ </method>
+
+ <!--- Allows to customize the minimum and maxium data value.
+ @param Number pMinX: the new minimum value in 'x' of the chart.
+ @param Number pMaxX: the new maximum value in 'x' of the chart.
+ @param Number pMinY: the new minimum value in 'y' of the chart.
+ @param Number pMaxY: the new maximum value in 'y' of the chart.
+ -->
+ <method name="customizeMinMax" args="pMinX, pMaxX, pMinY, pMaxY">
+ this.minx = pMinX;
+ this.maxx = pMaxX;
+ this.miny = pMinY;
+ this.maxy = pMaxY;
+ </method>
+
+ <!--- @keyword private -->
+ <method name="findMin" args="arr">
+ <![CDATA[
+ var min;
+ if(arr.length > 0) {
+ min = arr[0];
+ }
+ for(var i = 1; i < arr.length; i++) {
+ if(arr[i] < min) {
+ min = arr[i];
+ }
+ }
+ return min;
+ ]]>
+ </method>
+
+ <!--- @keyword private -->
+ <method name="findMax" args="arr">
+ <![CDATA[
+ var max;
+ if(arr.length > 0) {
+ max = arr[0];
+ }
+ for(var i = 1; i < arr.length; i++) {
+ if(max < arr[i]) {
+ max = arr[i];
+ }
+ }
+ return max;
+ ]]>
+ </method>
+
+ <!--- @keyword private -->
+ <chartactionhelper name="actionhelper" chart="${parent}"/>
+ <!--- change the virtual boundary of the rectangular chart
+ @param Number newminx: the new min x of the boundary
+ @param Number newminy: the new min y of the boundary
+ @param Number newmaxx: the new max x of the boundary
+ @param Number newmaxy: the new max y of the boundary
+ @param Number animated: the animation duration in milliseconds. 0 for no animation
+ @param Number undoable: deterimine if the action can be undo
+ -->
+ <method name="changeBound" args="newminx, newminy, newmaxx, newmaxy, animated, undoable">
+ actionhelper.changeBound(newminx, newminy, newmaxx, newmaxy, animated, undoable);
+ </method>
+ <!--- undo the last chart zoom interaction to the one previous -->
+ <method name="undo" args="duration">
+ actionhelper.undo(duration);
+ </method>
+ <method event="onRenderStart">
+ </method>
+ <method event="onRenderStop">
+ </method>
+
+ </class>
+
+ <!--- @keyword private
+ class that help with the zoom animation and undo ability
+ -->
+ <class name="chartactionhelper">
+ <attribute name="chart" type="expression"/>
+ <attribute name="actionlist" value="[]"/>
+ <attribute name="animateProgress" value="0" type="number"/>
+
+ <animator name="animatezoom" attribute="animateProgress" from="0" to="1" start="false" duration="500">
+ <method event="onstart">
+ parent.setAttribute("isdrawing", true);
+ </method>
+ <method event="onstop">
+ parent.setAttribute("isdrawing", false);
+ </method>
+ </animator>
+
+ <method name="changeBound" args="newminx, newminy, newmaxx, newmaxy, duration, undoable">
+ <![CDATA[
+
+ //Debug.write("changeBound(" + newminx + ", " + newminy + ", " + newmaxx + ", " + newmaxy + ")");
+ if(duration == null)
+ {
+ duration = 0;
+ }
+
+ if(undoable == null)
+ {
+ undoable = false;
+ }
+
+ chart.onRenderStart.sendEvent();
+ if(undoable)
+ {
+
+ this.actionlist.push(
+ {
+ minx : chart.minx,
+ miny : chart.miny,
+ maxx : chart.maxx,
+ maxy : chart.maxy
+ }
+ );
+ }
+
+ if(duration > 0)
+ {
+ this["origminx"] = new Number(chart.minx);
+ this["origminy"] = new Number(chart.miny);
+ this["origmaxx"] = new Number(chart.maxx);
+ this["origmaxy"] = new Number(chart.maxy);
+
+ this["newminx"] = new Number(newminx);
+ this["newminy"] = new Number(newminy);
+ this["newmaxx"] = new Number(newmaxx);
+ this["newmaxy"] = new Number(newmaxy);
+ this.animateProgress = 0;
+ this.animate("animateProgress", 1, duration, false);
+ }
+ else
+ {
+ /*
+ chart.minx = newminx;
+ chart.miny = newminy;
+ chart.maxx = newmaxx;
+ chart.maxx = newmaxy;
+ */
+ this.chart.setAttribute("minx", newminx);
+ this.chart.setAttribute("miny", newminy);
+ this.chart.setAttribute("maxx", newmaxx);
+ this.chart.setAttribute("maxy", newmaxy);
+
+ this.chart.render();
+ chart.onRenderStop.sendEvent();
+ }
+ ]]>
+ </method>
+
+ <method name="undo" args="duration">
+ var action = actionlist.pop();
+ if(action)
+ {
+ this.changeBound(action.minx, action.miny, action.maxx, action.maxy, duration, false);
+ }
+ </method>
+
+ <method event="onanimateProgress">
+ <![CDATA[
+ //Debug.write("AnimateStep: " + chart.minx + " " + chart.miny + " " + chart.maxx + " " + chart.maxy);
+
+ chart.setAttribute("minx", this.origminx + (this.newminx - this.origminx) * this.animateProgress);
+ chart.setAttribute("miny", this.origminy + (this.newminy - this.origminy) * this.animateProgress);
+ chart.setAttribute("maxx", this.origmaxx + (this.newmaxx - this.origmaxx) * this.animateProgress);
+ chart.setAttribute("maxy", this.origmaxy + (this.newmaxy - this.origmaxy) * this.animateProgress);
+
+
+ if(this.animateProgress < 1)
+ {
+ chart.render();
+ }
+ else
+ {
+ //chart.adjustOptimizeMinMax();
+ chart.render();
+ chart.onRenderStop.sendEvent();
+ }
+ ]]>
+ </method>
+ </class>
+</library>
+
+<!-- * X_LZ_COPYRIGHT_BEGIN
+***************************************************
+* Copyright 2001-2005 Laszlo Systems, Inc. All Rights Reserved.
+* Use is subject to license terms.
+* X_LZ_COPYRIGHT_END
+****************************************************** -->
+<!-- @LZX_VERSION@
+ -->
1.1.2.1 +315 -0 jboss-profiler/java/webapp/lps/components/charts/common/Attic/chart.lzx
(In the diff below, changes in quantity of whitespace are not shown.)
Index: chart.lzx
===================================================================
RCS file: chart.lzx
diff -N chart.lzx
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ chart.lzx 26 Oct 2006 09:00:55 -0000 1.1.2.1
@@ -0,0 +1,315 @@
+<library>
+ <include href="datatip.lzx"/>
+ <include href="charts/styles/styleparser.lzx"/>
+ <include href="charts/styles/defaultchartstyle.lzx"/>
+ <include href="base/basecomponent.lzx"/>
+ <!---
+ chart is the base class representing a chart. In general,
+ this class is not instantiated directly. A chart contains
+ at least one dataseries element
+ at least one axis element
+ The chart needs to look at its dataseries children and pass
+ the relevant dataseries to each axis. Relevent dataseries
+ for the chart must have columns for each of the axes
+ that the chart cares about.
+ -->
+ <class name="chart" extends="basecomponent">
+ <!--- @keywords private -->
+ <datatip name="datatooltip"/>
+ <!--- enable zoom-->
+ <attribute name="zoomEnabled" type="boolean" />
+ <!--- enable data point(data marker) -->
+ <attribute name="dataPointsEnabled" type="boolean" value="false"/>
+ <!--- enable tooltip for data -->
+ <attribute name="datatipEnabled" type="boolean" value="false"/>
+ <!--- data column name of the tooltip -->
+ <attribute name="datatipColumn" type="string" />
+ <!--- data column name of the data label -->
+ <attribute name="datalabelColumn" type="string" />
+ <!--- enable data label -->
+ <attribute name="datalabelEnabled" type="boolean" value="false"/>
+ <!--- @keyword private -->
+ <attribute name="plotarea" type="expression" value="${null}"/>
+ <!--- enable value lines -->
+ <attribute name="valuelinesenabled" type="boolean" value="true"/>
+ <!--- enable value points -->
+ <attribute name="valuepointsenabled" type="boolean" value="true"/>
+ <!--- enable value region -->
+ <attribute name="valueregionsenabled" type="boolean" value="true"/>
+ <attribute name="databorderEnabled" type="boolean" value="true" />
+ <!--- @keyword private -->
+ <attribute name="_datalabelpool" type="string" />
+ <!--- subview have -->
+ <attribute name="initdone" value="false" type="boolean"/>
+
+ <!-- Area Margins attributes -->
+ <!--- The blank space bordering the top of the chart area. -->
+ <attribute name="topMargin" type="number" value="10"/>
+ <!--- The blank space bordering the bottom of the chart area. -->
+ <attribute name="bottomMargin" type="number" value="10"/>
+ <!--- The blank space bordering the left side of the chart area. -->
+ <attribute name="leftMargin" type="number" value="10"/>
+ <!--- The blank space bordering the right side of the chart area. -->
+ <attribute name="rightMargin" type="number" value="10"/>
+ <!--- The default blank space bordering the right side of the chart area. -->
+ <attribute name="defaultRightMargin" type="number" value="10"/>
+ <!-- Gaps between components -->
+ <!--- The vertical blank space between components. -->
+ <attribute name="verticalGap" type="number" value="5"/>
+ <!--- The horizontal blank space between components. -->
+ <attribute name="horizontalGap" type="number" value="5"/>
+ <!-- End of Area Margins attributes -->
+
+ <!--- The default style to be applied to the chart. -->
+ <attribute name="defaultstyle" type="expression" value="${defaultchartstyle}"/>
+
+ <!--- @keywords private
+ Object to render the stroke and the gradient chartBackground-->
+ <drawview name="chartBackground" width="${parent.width}" height="${parent.height}" visible="false"/>
+
+ <!--- @keywords private
+ Object to render the stroke and the gradient plotareabackground-->
+ <drawview name="plotareabackground"/>
+
+ <method event="oninitdone">
+ // No style defined.
+ if( this.style.classname != "chartstyle" ) {
+ this.style = this.defaultstyle;
+ } else {
+ // Check for a complete style definition.
+ var parser = new styleparser(this, {style:this.style, defaultstyle:this.defaultstyle});
+ this.style = parser.style;
+ }
+
+ var rootseries = this.getDataSeries();
+ //if(rootseries["datadone"])
+ {
+ this.dataload();
+ }
+ new LzDelegate(this,"dataload", rootseries, "ondatadone");
+ </method>
+
+ <!--- @keywords private -->
+ <method name="applyBGStyle" args="s">
+ <![CDATA[
+ this.chartBackground.clear();
+ this.chartBackground.setAttribute( "visible", false );
+
+ this.chartBackground.setAttribute( "lineWidth", s.line.size );
+ this.chartBackground.setAttribute( "strokeStyle", s.line.color );
+ this.chartBackground.globalAlpha = s.line.opacity;
+
+ var lOffset = Math.floor(this.chartBackground.lineWidth / 2);
+
+ this.chartBackground.beginPath();
+ this.chartBackground.lineTo(lOffset, lOffset);
+ this.chartBackground.lineTo(this.width-lOffset, lOffset);
+ this.chartBackground.lineTo(this.width-lOffset, this.height-lOffset);
+ this.chartBackground.lineTo(lOffset, this.height-lOffset);
+ this.chartBackground.lineTo(lOffset, lOffset);
+ this.chartBackground.closePath();
+
+ this.chartBackground.stroke();
+
+ this.chartBackground.setAttribute( "width", this.width );
+ this.chartBackground.setAttribute( "height", this.height );
+
+ if( s.region.gradient != null && s.region.gradient != "none" ) {
+ var g = null;
+
+ if( s.region.gradient == "linear" ) {
+ g = this.chartBackground.createLinearGradient(0, 0, this.width, this.height);
+ } else if ( s.region.gradient == "radial" ) {
+ g = this.chartBackground.createRadialGradient(0, 0,
+ .7, this.width, this.height, 0);
+ }
+
+ this.chartBackground.sendToBack();
+
+ if( g != null ) {
+ this.chartBackground.globalAlpha = 0;
+ g.addColorStop(0, 0x000000);
+ this.chartBackground.globalAlpha = 1;
+ g.addColorStop(1, s.region.color);
+ this.chartBackground.fillStyle = g;
+ }
+ } else if( s.region.image != null ) {
+ this.chartBackground.setSource( s.region.image );
+ //this.chartBackground.globalAlpha = s.region.opacity;
+ // TODO::The transparency value is being applied to the entire view.
+ // It should be applied only to the image by using globalAlpha (see commented)
+ // line above.
+ this.chartBackground.setAttribute( "opacity", s.region.opacity );
+ this.chartBackground.stretchResource();
+ } else {
+ this.chartBackground.fillStyle = s.region.color;
+ this.chartBackground.globalAlpha = s.region.opacity;
+ }
+
+ lOffset = 2*lOffset;
+
+ this.chartBackground.beginPath();
+ this.chartBackground.lineTo(lOffset, lOffset);
+ this.chartBackground.lineTo(this.width-lOffset, lOffset);
+ this.chartBackground.lineTo(this.width-lOffset, this.height-lOffset);
+ this.chartBackground.lineTo(lOffset, this.height-lOffset);
+ this.chartBackground.lineTo(lOffset, lOffset);
+ this.chartBackground.closePath();
+
+ this.chartBackground.fill();
+ this.chartBackground.setAttribute( "visible", true );
+ ]]>
+ </method>
+
+ <!--- Method that renders the chart. This method is overridden by
+ class rectangularchart. The class piechart uses it as is. -->
+ <method name="render">
+ this.applyBGStyle( this.style.chartbgstyle );
+ this.renderPlotArea();
+ </method>
+
+ <!--- @keyword private -->
+ <method name="createLabelViewspool">
+ return new viewspool(this, {parentview:this.plotarea, viewclass:'datalabel'})
+ </method>
+
+ <!--- @keyword private -->
+ <method name="renderPlotArea">
+ this.adjustPlotAreaToLayout();
+
+ this.plotareabackground.clear();
+
+ this.plotareabackground.setAttribute( "x", this.plotarea.x );
+ this.plotareabackground.setAttribute( "y", this.plotarea.y );
+ this.plotareabackground.setAttribute( "width", this.plotarea.width );
+ this.plotareabackground.setAttribute( "height", this.plotarea.height );
+
+ this.plotareabackground.lineWidth = this.style.plot.linesize;
+ this.plotareabackground.strokeStyle = this.style.plot.linecolor;
+
+ var lOffset = Math.floor(this.plotareabackground.lineWidth / 2);
+
+ this.plotareabackground.beginPath();
+ this.plotareabackground.moveTo(lOffset,lOffset);
+ this.plotareabackground.lineTo(this.plotarea.width-lOffset, lOffset);
+ this.plotareabackground.lineTo(this.plotarea.width-lOffset, this.plotarea.height-lOffset);
+ this.plotareabackground.lineTo(lOffset,this.plotarea.height-lOffset);
+ this.plotareabackground.lineTo(lOffset,lOffset);
+ this.plotareabackground.closePath();
+
+ this.plotareabackground.stroke();
+ this.plotareabackground.setAttribute( "width", this.plotarea.width );
+ this.plotareabackground.setAttribute( "height", this.plotarea.height );
+
+ lOffset = 2*lOffset;
+
+ this.plotareabackground.beginPath();
+ this.plotareabackground.moveTo(lOffset,lOffset);
+ this.plotareabackground.lineTo(this.plotarea.width-lOffset, lOffset);
+ this.plotareabackground.lineTo(this.plotarea.width-lOffset, this.plotarea.height-lOffset);
+ this.plotareabackground.lineTo(lOffset,this.plotarea.height-lOffset);
+ this.plotareabackground.lineTo(lOffset,lOffset);
+ this.plotareabackground.closePath();
+
+ this.plotareabackground.lineWidth = this.style.plot.linesize;
+ this.plotareabackground.strokeStyle = this.style.plot.linecolor;
+ this.plotareabackground.fillStyle = this.style.plot.fillcolor;
+ this.plotareabackground.globalAlpha = this.style.plot.opacity;
+
+ this.plotareabackground.stroke();
+ this.plotareabackground.fill();
+ </method>
+
+ <!--- @keywords private
+ rerender a chart when new data come in -->
+ <method name="dataload">
+ //FIX ME!!(peter, 6/27/2005) not sure why this.style.plot.parent != this.style
+ //clear cached to reapply all style
+ this.style.plot.parent.markChange();
+
+ this.render();
+ </method>
+
+ <!--- return an array of subnodes with the class name
+ @param string className: name of the class -->
+ <method name="getNodesOfClass" args="className">
+ <![CDATA[
+ var objs = [];
+ for (var i = 0; i < this.subnodes.length; i++)
+ {
+ if(this.subnodes[i].classname == className)
+ {
+ objs.push(this.subnodes[i]);
+ }
+ }
+ return objs;
+ ]]>
+ </method>
+
+ <!--- return a subnode with the class name
+ @param string className: name of the class -->
+ <method name="getNodeOfClass" args="className">
+ <![CDATA[
+ var objs = [];
+ for (var i = this.subnodes.length - 1; i >= 0; i--)
+ {
+ if(this.subnodes[i].classname == className)
+ {
+ return this.subnodes[i];
+ }
+ }
+ return null;
+ ]]>
+ </method>
+
+ <!--- get the dataseries -->
+ <method name="getDataSeries">
+ return this.getNodeOfClass("dataseries");
+ </method>
+
+ <!--- Adjust the plot area to the dimensions of the chart and other
+ components -->
+ <method name="adjustPlotAreaToLayout">
+ // Adjust the plot area to the chart area.
+ if( this.plotarea != null ) {
+ var lWidth;
+ var lHeight;
+ var lX;
+ var lY;
+
+ lX = this.leftMargin;
+ lY = this.topMargin;
+ lWidth = this.width - (this.leftMargin + this.rightMargin);
+ lHeight = this.height - (this.topMargin + this.bottomMargin);
+
+ this.plotarea.setAttribute( "width", lWidth );
+ this.plotarea.setAttribute( "height", lHeight );
+ this.plotarea.setAttribute( "x", lX );
+ this.plotarea.setAttribute( "y", lY );
+ }
+ </method>
+
+ <!-- dummy view to determine of all child views have finished init -->
+ <view visible="false" initstage="late">
+ <method name="init">
+ parent.setAttribute("initdone", true);
+ </method>
+ <view/>
+ </view>
+ <method event="oninitdone">
+//HACK begin
+ //Debug.write("initdone: " + this.initdone);
+// HACK end
+ </method>
+
+ </class>
+</library>
+
+<!-- * X_LZ_COPYRIGHT_BEGIN
+***************************************************
+* Copyright 2001-2005 Laszlo Systems, Inc. All Rights Reserved.
+* Use is subject to license terms.
+* X_LZ_COPYRIGHT_END
+****************************************************** -->
+<!-- @LZX_VERSION@
+ -->
1.1.2.1 +171 -0 jboss-profiler/java/webapp/lps/components/charts/common/Attic/verticalaxis.lzx
(In the diff below, changes in quantity of whitespace are not shown.)
Index: verticalaxis.lzx
===================================================================
RCS file: verticalaxis.lzx
diff -N verticalaxis.lzx
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ verticalaxis.lzx 26 Oct 2006 09:00:55 -0000 1.1.2.1
@@ -0,0 +1,171 @@
+<library>
+ <include href="../styles/strokestyle.lzx"/>
+ <include href="../common/label.lzx"/>
+ <include href="axis.lzx"/>
+<!-- Begin Vertical Axis Class -->
+<!--- Represents the Y axis on the rectangular chart, extends from Axis class -->
+ <class name="verticalaxis" extends="axis">
+ <!--- @keyword private-->
+ <attribute name="datacolumn" type="string" value="y" />
+ <!--- Init
+ @keyword private
+ -->
+ <method name="init">
+ this.setWidth(objStroke.strokeWidth);
+ super.init();
+ </method>
+ <!--- Render the vertical axis line
+ @keyword private
+ -->
+ <method name="renderAxis">
+ <![CDATA[
+ this.minimumRender = parent.miny;
+ this.maximumRender = parent.maxy;
+
+ objStroke.renderStroke(0, 0, 0, this.height);
+
+ ]]>
+ </method>
+ <!--- Render axis title
+ @keyword private
+ -->
+ <method name="renderTitle">
+ <![CDATA[
+ if ( this.titleX == null && this.titleY == null ){
+ switch( titleLocation ) {
+ case "high":
+ this.titleView.setX((this.width + this.style.tickmajor.length)+titleGap);
+ this.titleView.setY((this.height)/2);
+ break;
+
+ case "low":
+ this.titleView.setX(-(this.width + this.tickMarksView.width)- titleGap - titleView.width);
+ this.titleView.setY((this.height)/2);
+ if ( this.titleView.embeddedFont(style.label.fontname) ){
+ if ( style.label.fontangle > 20 && style.label.fontangle < 45)
+ this.titleView.setX(this.titleView.x + this.titleView.width/4);
+ else if ( (style.label.fontangle > 45 && style.label.fontangle < 90) || (style.label.fontangle > 220 && style.label.fontangle <= 270))
+ this.titleView.setX(this.titleView.x + this.titleView.width/2);
+ else if ( style.label.fontangle >= 90 && style.label.fontangle < 220)
+ this.titleView.setX(this.titleView.x + this.titleView.width);
+ }
+ break;
+// HACK begin
+ default:
+ var cWidth = _mapWidth(this.titleView.width, this.titleView.height, style.label.fontangle);
+ var cHeight = _mapHeight(this.titleView.width, this.titleView.height, style.label.fontangle);
+ this.titleView.setX(-tickMarksView.width-cWidth);
+ this.titleView.setY(this.height/2-cHeight/2);
+ //this.titleView.setX(- (this.titleView.width/2));
+ //this.titleView.setY( - this.titleGap - this.titleView.height);
+ break;
+// HACK end
+ }
+ } else {
+ this.titleView.setX(this.titleX);
+ this.titleView.setY(this.titleY);
+ }
+ ]]>
+ </method>
+
+<!-- HACK begin -->
+ <method name="_mapWidth" args="width,height,rotation">
+ return Math.abs(width*_floor(Math.cos(rotation/180*Math.PI))+
+ height*_floor(Math.sin(rotation/180*Math.PI)));
+ </method>
+
+ <method name="_mapHeight" args="width,height,rotation">
+ return Math.abs(width*_floor(Math.sin(rotation/180*Math.PI))+
+ height*_floor(Math.cos(rotation/180*Math.PI)));
+ </method>
+
+ <method name="_floor" args="value">
+ return Math.floor(value*1000)/1000;
+ </method>
+<!-- HACK end -->
+
+ <!--- setter for scale and offset
+ @keyword private
+ -->
+ <method name="setScaleAndOffset">
+ <![CDATA[
+ this.scale = this.height / (this.maximum - this.minimum);
+ this.offset = - this.minimum * this.scale;
+
+ //flip y
+ this.offset = this.height - this.offset;
+ this.scale = - this.scale;
+ ]]>
+ </method>
+ <!--- Method to return a pixel position given graph data
+ @param Number pInput: for linear charts a graphicable data.
+ @keyword private
+ -->
+ <method name="getPixelDistance" args="pInput">
+ <![CDATA[
+ //FIXME : Find out why the current pixel rate is not accurate
+ return ((pInput - this.minimumRender) * (this.height/(this.maximumRender - this.minimumRender)));
+ ]]>
+ </method>
+ <!--- Get the length of the axis.
+ @keyword private
+ -->
+ <method name="getAxisLength">
+ <![CDATA[
+ return this.height;
+ ]]>
+ </method>
+ <!--- Check label location and change placement to avoid labels
+ overlaping
+ @keywords private -->
+ <method name="reposLabels" args="pMarks"></method>
+
+ <!--- Render a tick mark
+ @param Number pOffset: displacement depending on the position of the tickmark
+ @param Number pPos: actual tickmark position along the axis
+ @param expression pStyle: tickmark style object to use on the render
+ @keywords private -->
+ <method name="renderTickMark" args="pOffset,pPos,pStyle"> <![CDATA[
+ this.beginPath();
+
+ this.moveTo(- pOffset, this.height-pPos);
+ this.lineTo(pStyle.length-pOffset , this.height-pPos);
+
+ //set color
+ this.strokeStyle = pStyle.color;
+ this.lineWidth = pStyle.size;
+ //complete line
+ this.stroke();
+ ]]>
+ </method>
+ <!--- Set label position
+ @keywords private -->
+ <method name="setLabelPos" args="pLabel,pOffset,pTW,pTH,pPos">
+ <![CDATA[
+ pLabel.setX(-pOffset-pTW);
+ pLabel.setY( this.height-pPos-(pTH/2) );
+
+ if ( (pLabel.getTextWidth() + this.style.tickmajor.length) >= this.tickMarksView.width )
+ this.tickMarksView.setAttribute('width', this.style.tickmajor.length + pLabel.getTextWidth());
+
+ ]]>
+ </method>
+ <!--- Render tickmarks
+ @keyword private -->
+ <method name="renderTick"> <![CDATA[
+ if (type.toUpperCase()=='CATEGORICAL') {
+ renderCategoricalTick();
+ } else if (type.toUpperCase()=='LINEAR') {
+ renderLinearTick();
+ }
+ ]]> </method>
+ </class>
+ </library>
+<!-- End Vertical Axis Class -->
+<!-- * X_LZ_COPYRIGHT_BEGIN
+***************************************************
+* Copyright 2001-2005 Laszlo Systems, Inc. All Rights Reserved.
+* Use is subject to license terms.
+* X_LZ_COPYRIGHT_END
+****************************************************** -->
+<!-- @LZX_VERSION@ -->
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list