001/** 002 * 003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. 004 * 005 * This library is free software; you can redistribute it and/or 006 * modify it under the terms of the GNU Lesser General Public 007 * License as published by the Free Software Foundation; either 008 * version 2.1 of the License, or (at your option) any later version. 009 * 010 * This library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 * Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 017 * 018 **/ 019package lucee.runtime.tag; 020 021import lucee.runtime.exp.ExpressionException; 022import lucee.runtime.ext.tag.TagImpl; 023 024/** 025* Displays a graphical representation of data. 026* 027* 028* 029**/ 030public final class Graph extends TagImpl { 031 032 /** The font used for the item labels. */ 033 private String itemlabelfont; 034 035 /** The placement of the legend that identifies colors with the data labels. */ 036 private String showlegend; 037 038 /** Title to display centered above the chart, or below the chart if the legend is above the chart. */ 039 private String title; 040 041 /** The size the value text, in points. */ 042 private double valuelabelsize; 043 044 /** The size of the item labels, in points. */ 045 private double itemlabelsize; 046 047 /** Width of the graph line, in pixels. */ 048 private double fill; 049 050 /** Border color. */ 051 private String bordercolor; 052 053 /** Name of the query containing the data to graph. Required if you do not use cfgraphdata tags in the cfgraph tag body to specify the data values. */ 054 private String query; 055 056 /** The font used to display data values. */ 057 private String valuelabelfont; 058 059 /** The font used to display the title. */ 060 private String titlefont; 061 062 /** An integer that specifies the number of grid lines to display on the chart between the top and bottom lines. */ 063 private double gridlines; 064 065 /** A URL to load when the user clicks any data point on the chart. */ 066 private String url; 067 068 /** Query column that contains the data values. 069 ** Required if you do not use cfgraphdata tags in the cfgraph tag body to specify the data values. */ 070 private String valuecolumn; 071 072 /** Spacing between bars in the chart, in pixels. */ 073 private double barspacing; 074 075 /** Specifies whether to fill the area below the line with the line color to create an area graph. */ 076 private double linewidth; 077 078 /** Border thickness, in pixels. */ 079 private String borderwidth; 080 081 /** Specifies whether values are displayed for the data points. */ 082 private boolean showvaluelabel; 083 084 /** The minimum value of the graph value axis (the vertical axis for Bar charts, the horizontal axis for HorizontalBar charts). */ 085 private double scalefrom; 086 087 /** Specifies whether to put item labels on the horizontal axis of bar charts and the vertical axis of HorizontalBar charts. */ 088 private boolean showitemlabel; 089 090 /** Type of chart to display. */ 091 private String type; 092 093 /** Depth of 3D chart appearance, in pixels. */ 094 private double depth; 095 096 /** Query column containing URL information to load when the user clicks the corresponding data point. */ 097 private String urlcolumn; 098 099 /** The font used to display the legend. */ 100 private String legendfont; 101 102 /** Color of the chart background. */ 103 private String backgroundcolor; 104 105 /** Comma delimited list of colors to use for each data point. */ 106 private String colorlist; 107 108 /** The maximum value of the graph value axis. */ 109 private double scaleto; 110 111 /** Width of the graph, in pixels. Default is 320. */ 112 private double graphwidth; 113 114 /** Where value labels are placed. */ 115 private String valuelocation; 116 117 /** Query column that contains the item label for the corresponding data point. The item labels appear in the chart legend. */ 118 private String itemcolumn; 119 120 /** Orientation of item labels. */ 121 private String itemlabelorientation; 122 123 /** The color used to draw the data line. */ 124 private String linecolor; 125 126 /** Height of the graph, in pixels. Default is 240. */ 127 private double graphheight; 128 129 /** File type to be used for the output displayed in the browser. */ 130 private String fileformat; 131 132 133 /** 134 * constructor for the tag class 135 **/ 136 public Graph() throws ExpressionException { 137 throw new ExpressionException("tag cfgraph is deprecated"); 138 } 139 140 /** set the value itemlabelfont 141 * The font used for the item labels. 142 * @param itemlabelfont value to set 143 **/ 144 public void setItemlabelfont(String itemlabelfont) { 145 this.itemlabelfont=itemlabelfont; 146 } 147 148 /** set the value showlegend 149 * The placement of the legend that identifies colors with the data labels. 150 * @param showlegend value to set 151 **/ 152 public void setShowlegend(String showlegend) { 153 this.showlegend=showlegend; 154 } 155 156 /** set the value title 157 * Title to display centered above the chart, or below the chart if the legend is above the chart. 158 * @param title value to set 159 **/ 160 public void setTitle(String title) { 161 this.title=title; 162 } 163 164 /** set the value valuelabelsize 165 * The size the value text, in points. 166 * @param valuelabelsize value to set 167 **/ 168 public void setValuelabelsize(double valuelabelsize) { 169 this.valuelabelsize=valuelabelsize; 170 } 171 172 /** set the value itemlabelsize 173 * The size of the item labels, in points. 174 * @param itemlabelsize value to set 175 **/ 176 public void setItemlabelsize(double itemlabelsize) { 177 this.itemlabelsize=itemlabelsize; 178 } 179 180 /** set the value fill 181 * Width of the graph line, in pixels. 182 * @param fill value to set 183 **/ 184 public void setFill(double fill) { 185 this.fill=fill; 186 } 187 188 /** set the value bordercolor 189 * Border color. 190 * @param bordercolor value to set 191 **/ 192 public void setBordercolor(String bordercolor) { 193 this.bordercolor=bordercolor; 194 } 195 196 /** set the value query 197 * Name of the query containing the data to graph. Required if you do not use cfgraphdata tags in the cfgraph tag body to specify the data values. 198 * @param query value to set 199 **/ 200 public void setQuery(String query) { 201 this.query=query; 202 } 203 204 /** set the value valuelabelfont 205 * The font used to display data values. 206 * @param valuelabelfont value to set 207 **/ 208 public void setValuelabelfont(String valuelabelfont) { 209 this.valuelabelfont=valuelabelfont; 210 } 211 212 /** set the value titlefont 213 * The font used to display the title. 214 * @param titlefont value to set 215 **/ 216 public void setTitlefont(String titlefont) { 217 this.titlefont=titlefont; 218 } 219 220 /** set the value gridlines 221 * An integer that specifies the number of grid lines to display on the chart between the top and bottom lines. 222 * @param gridlines value to set 223 **/ 224 public void setGridlines(double gridlines) { 225 this.gridlines=gridlines; 226 } 227 228 /** set the value url 229 * A URL to load when the user clicks any data point on the chart. 230 * @param url value to set 231 **/ 232 public void setUrl(String url) { 233 this.url=url; 234 } 235 236 /** set the value valuecolumn 237 * Query column that contains the data values. 238 * Required if you do not use cfgraphdata tags in the cfgraph tag body to specify the data values. 239 * @param valuecolumn value to set 240 **/ 241 public void setValuecolumn(String valuecolumn) { 242 this.valuecolumn=valuecolumn; 243 } 244 245 /** set the value barspacing 246 * Spacing between bars in the chart, in pixels. 247 * @param barspacing value to set 248 **/ 249 public void setBarspacing(double barspacing) { 250 this.barspacing=barspacing; 251 } 252 253 /** set the value linewidth 254 * Specifies whether to fill the area below the line with the line color to create an area graph. 255 * @param linewidth value to set 256 **/ 257 public void setLinewidth(double linewidth) { 258 this.linewidth=linewidth; 259 } 260 261 /** set the value borderwidth 262 * Border thickness, in pixels. 263 * @param borderwidth value to set 264 **/ 265 public void setBorderwidth(String borderwidth) { 266 this.borderwidth=borderwidth; 267 } 268 269 /** set the value showvaluelabel 270 * Specifies whether values are displayed for the data points. 271 * @param showvaluelabel value to set 272 **/ 273 public void setShowvaluelabel(boolean showvaluelabel) { 274 this.showvaluelabel=showvaluelabel; 275 } 276 277 /** set the value scalefrom 278 * The minimum value of the graph value axis (the vertical axis for Bar charts, the horizontal axis for HorizontalBar charts). 279 * @param scalefrom value to set 280 **/ 281 public void setScalefrom(double scalefrom) { 282 this.scalefrom=scalefrom; 283 } 284 285 /** set the value showitemlabel 286 * Specifies whether to put item labels on the horizontal axis of bar charts and the vertical axis of HorizontalBar charts. 287 * @param showitemlabel value to set 288 **/ 289 public void setShowitemlabel(boolean showitemlabel) { 290 this.showitemlabel=showitemlabel; 291 } 292 293 /** set the value type 294 * Type of chart to display. 295 * @param type value to set 296 **/ 297 public void setType(String type) { 298 this.type=type; 299 } 300 301 /** set the value depth 302 * Depth of 3D chart appearance, in pixels. 303 * @param depth value to set 304 **/ 305 public void setDepth(double depth) { 306 this.depth=depth; 307 } 308 309 /** set the value urlcolumn 310 * Query column containing URL information to load when the user clicks the corresponding data point. 311 * @param urlcolumn value to set 312 **/ 313 public void setUrlcolumn(String urlcolumn) { 314 this.urlcolumn=urlcolumn; 315 } 316 317 /** set the value legendfont 318 * The font used to display the legend. 319 * @param legendfont value to set 320 **/ 321 public void setLegendfont(String legendfont) { 322 this.legendfont=legendfont; 323 } 324 325 /** set the value backgroundcolor 326 * Color of the chart background. 327 * @param backgroundcolor value to set 328 **/ 329 public void setBackgroundcolor(String backgroundcolor) { 330 this.backgroundcolor=backgroundcolor; 331 } 332 333 /** set the value colorlist 334 * Comma delimited list of colors to use for each data point. 335 * @param colorlist value to set 336 **/ 337 public void setColorlist(String colorlist) { 338 this.colorlist=colorlist; 339 } 340 341 /** set the value scaleto 342 * The maximum value of the graph value axis. 343 * @param scaleto value to set 344 **/ 345 public void setScaleto(double scaleto) { 346 this.scaleto=scaleto; 347 } 348 349 /** set the value graphwidth 350 * Width of the graph, in pixels. Default is 320. 351 * @param graphwidth value to set 352 **/ 353 public void setGraphwidth(double graphwidth) { 354 this.graphwidth=graphwidth; 355 } 356 357 /** set the value valuelocation 358 * Where value labels are placed. 359 * @param valuelocation value to set 360 **/ 361 public void setValuelocation(String valuelocation) { 362 this.valuelocation=valuelocation; 363 } 364 365 /** set the value itemcolumn 366 * Query column that contains the item label for the corresponding data point. The item labels appear in the chart legend. 367 * @param itemcolumn value to set 368 **/ 369 public void setItemcolumn(String itemcolumn) { 370 this.itemcolumn=itemcolumn; 371 } 372 373 /** set the value itemlabelorientation 374 * Orientation of item labels. 375 * @param itemlabelorientation value to set 376 **/ 377 public void setItemlabelorientation(String itemlabelorientation) { 378 this.itemlabelorientation=itemlabelorientation; 379 } 380 381 /** set the value linecolor 382 * The color used to draw the data line. 383 * @param linecolor value to set 384 **/ 385 public void setLinecolor(String linecolor) { 386 this.linecolor=linecolor; 387 } 388 389 /** set the value graphheight 390 * Height of the graph, in pixels. Default is 240. 391 * @param graphheight value to set 392 **/ 393 public void setGraphheight(double graphheight) { 394 this.graphheight=graphheight; 395 } 396 397 /** set the value fileformat 398 * File type to be used for the output displayed in the browser. 399 * @param fileformat value to set 400 **/ 401 public void setFileformat(String fileformat) { 402 this.fileformat=fileformat; 403 } 404 405 406 @Override 407 public int doStartTag() { 408 return SKIP_BODY; 409 } 410 411 @Override 412 public int doEndTag() { 413 return EVAL_PAGE; 414 } 415 416 @Override 417 public void release() { 418 super.release(); 419 itemlabelfont=""; 420 showlegend=""; 421 title=""; 422 valuelabelsize=0d; 423 itemlabelsize=0d; 424 fill=0d; 425 bordercolor=""; 426 query=""; 427 valuelabelfont=""; 428 titlefont=""; 429 gridlines=0d; 430 url=""; 431 valuecolumn=""; 432 barspacing=0d; 433 linewidth=0d; 434 borderwidth=""; 435 showvaluelabel=false; 436 scalefrom=0d; 437 showitemlabel=false; 438 type=""; 439 depth=0d; 440 urlcolumn=""; 441 legendfont=""; 442 backgroundcolor=""; 443 colorlist=""; 444 scaleto=0d; 445 graphwidth=0d; 446 valuelocation=""; 447 itemcolumn=""; 448 itemlabelorientation=""; 449 linecolor=""; 450 graphheight=0d; 451 fileformat=""; 452 } 453}