001/* =========================================================== 002 * JFreeChart : a free chart library for the Java(tm) platform 003 * =========================================================== 004 * 005 * (C) Copyright 2000-2022, by David Gilbert and Contributors. 006 * 007 * Project Info: http://www.jfree.org/jfreechart/index.html 008 * 009 * This library is free software; you can redistribute it and/or modify it 010 * under the terms of the GNU Lesser General Public License as published by 011 * the Free Software Foundation; either version 2.1 of the License, or 012 * (at your option) any later version. 013 * 014 * This library is distributed in the hope that it will be useful, but 015 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 016 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 017 * License for more details. 018 * 019 * You should have received a copy of the GNU Lesser General Public 020 * License along with this library; if not, write to the Free Software 021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 022 * USA. 023 * 024 * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. 025 * Other names may be trademarks of their respective owners.] 026 * 027 * --------------- 028 * ChartUtils.java 029 * --------------- 030 * (C) Copyright 2001-2022, by David Gilbert and Contributors. 031 * 032 * Original Author: David Gilbert; 033 * Contributor(s): Wolfgang Irler; 034 * Richard Atkinson; 035 * Xavier Poinsard; 036 * 037 */ 038 039package org.jfree.chart; 040 041import java.awt.Graphics2D; 042import java.awt.geom.AffineTransform; 043import java.awt.geom.Rectangle2D; 044import java.awt.image.BufferedImage; 045import java.io.BufferedOutputStream; 046import java.io.File; 047import java.io.FileOutputStream; 048import java.io.IOException; 049import java.io.OutputStream; 050import java.io.PrintWriter; 051 052import org.jfree.chart.encoders.EncoderUtil; 053import org.jfree.chart.encoders.ImageFormat; 054import org.jfree.chart.imagemap.ImageMapUtils; 055import org.jfree.chart.imagemap.OverLIBToolTipTagFragmentGenerator; 056import org.jfree.chart.imagemap.StandardToolTipTagFragmentGenerator; 057import org.jfree.chart.imagemap.StandardURLTagFragmentGenerator; 058import org.jfree.chart.imagemap.ToolTipTagFragmentGenerator; 059import org.jfree.chart.imagemap.URLTagFragmentGenerator; 060import org.jfree.chart.internal.Args; 061 062/** 063 * A collection of utility methods for JFreeChart. Includes methods for 064 * converting charts to image formats (PNG and JPEG) plus creating simple HTML 065 * image maps. 066 * 067 * @see ImageMapUtils 068 */ 069public abstract class ChartUtils { 070 071 /** 072 * Returns {@code true} if JFreeSVG is on the classpath, and 073 * {@code false} otherwise. The JFreeSVG library can be found at 074 * http://www.jfree.org/jfreesvg/ 075 * 076 * @return A boolean. 077 * 078 * @since 2.0.0 079 */ 080 public static boolean isJFreeSVGAvailable() { 081 Class<?> svgGraphics2DClass = null; 082 try { 083 svgGraphics2DClass = Class.forName("org.jfree.svg.SVGGraphics2D"); 084 } catch (ClassNotFoundException e) { 085 // svgGraphics2DClass will be null so the function will return false 086 } 087 return svgGraphics2DClass != null; 088 } 089 090 /** 091 * Returns {@code true} if OrsonPDF is on the classpath, and 092 * {@code false} otherwise. The OrsonPDF library can be found at 093 * http://www.object-refinery.com/orsonpdf/ 094 * 095 * @return A boolean. 096 * 097 * @since 2.0.0 098 */ 099 public static boolean isOrsonPDFAvailable() { 100 Class<?> pdfDocumentClass = null; 101 try { 102 pdfDocumentClass = Class.forName("com.orsonpdf.PDFDocument"); 103 } catch (ClassNotFoundException e) { 104 // pdfDocument class will be null so the function will return false 105 } 106 return (pdfDocumentClass != null); 107 } 108 109 /** 110 * Applies the current theme to the specified chart. This method is 111 * provided for convenience, the theme itself is stored in the 112 * {@link ChartFactory} class. 113 * 114 * @param chart the chart ({@code null} not permitted). 115 */ 116 public static void applyCurrentTheme(JFreeChart chart) { 117 ChartFactory.getChartTheme().apply(chart); 118 } 119 120 /** 121 * Writes a chart to an output stream in PNG format. 122 * 123 * @param out the output stream ({@code null} not permitted). 124 * @param chart the chart ({@code null} not permitted). 125 * @param width the image width. 126 * @param height the image height. 127 * 128 * @throws IOException if there are any I/O errors. 129 */ 130 public static void writeChartAsPNG(OutputStream out, JFreeChart chart, 131 int width, int height) throws IOException { 132 133 // defer argument checking... 134 writeChartAsPNG(out, chart, width, height, null); 135 136 } 137 138 /** 139 * Writes a chart to an output stream in PNG format. 140 * 141 * @param out the output stream ({@code null} not permitted). 142 * @param chart the chart ({@code null} not permitted). 143 * @param width the image width. 144 * @param height the image height. 145 * @param encodeAlpha encode alpha? 146 * @param compression the compression level (0-9). 147 * 148 * @throws IOException if there are any I/O errors. 149 */ 150 public static void writeChartAsPNG(OutputStream out, JFreeChart chart, 151 int width, int height, boolean encodeAlpha, int compression) 152 throws IOException { 153 154 // defer argument checking... 155 ChartUtils.writeChartAsPNG(out, chart, width, height, null, 156 encodeAlpha, compression); 157 158 } 159 160 /** 161 * Writes a chart to an output stream in PNG format. This method allows 162 * you to pass in a {@link ChartRenderingInfo} object, to collect 163 * information about the chart dimensions/entities. You will need this 164 * info if you want to create an HTML image map. 165 * 166 * @param out the output stream ({@code null} not permitted). 167 * @param chart the chart ({@code null} not permitted). 168 * @param width the image width. 169 * @param height the image height. 170 * @param info the chart rendering info ({@code null} permitted). 171 * 172 * @throws IOException if there are any I/O errors. 173 */ 174 public static void writeChartAsPNG(OutputStream out, JFreeChart chart, 175 int width, int height, ChartRenderingInfo info) 176 throws IOException { 177 178 Args.nullNotPermitted(chart, "chart"); 179 BufferedImage bufferedImage 180 = chart.createBufferedImage(width, height, info); 181 EncoderUtil.writeBufferedImage(bufferedImage, ImageFormat.PNG, out); 182 } 183 184 /** 185 * Writes a chart to an output stream in PNG format. This method allows 186 * you to pass in a {@link ChartRenderingInfo} object, to collect 187 * information about the chart dimensions/entities. You will need this 188 * info if you want to create an HTML image map. 189 * 190 * @param out the output stream ({@code null} not permitted). 191 * @param chart the chart ({@code null} not permitted). 192 * @param width the image width. 193 * @param height the image height. 194 * @param info carries back chart rendering info ({@code null} 195 * permitted). 196 * @param encodeAlpha encode alpha? 197 * @param compression the PNG compression level (0-9). 198 * 199 * @throws IOException if there are any I/O errors. 200 */ 201 public static void writeChartAsPNG(OutputStream out, JFreeChart chart, 202 int width, int height, ChartRenderingInfo info, 203 boolean encodeAlpha, int compression) throws IOException { 204 205 Args.nullNotPermitted(out, "out"); 206 Args.nullNotPermitted(chart, "chart"); 207 BufferedImage chartImage = chart.createBufferedImage(width, height, 208 BufferedImage.TYPE_INT_ARGB, info); 209 ChartUtils.writeBufferedImageAsPNG(out, chartImage, encodeAlpha, 210 compression); 211 212 } 213 214 /** 215 * Writes a scaled version of a chart to an output stream in PNG format. 216 * 217 * @param out the output stream ({@code null} not permitted). 218 * @param chart the chart ({@code null} not permitted). 219 * @param width the unscaled chart width. 220 * @param height the unscaled chart height. 221 * @param widthScaleFactor the horizontal scale factor. 222 * @param heightScaleFactor the vertical scale factor. 223 * 224 * @throws IOException if there are any I/O problems. 225 */ 226 public static void writeScaledChartAsPNG(OutputStream out, 227 JFreeChart chart, int width, int height, int widthScaleFactor, 228 int heightScaleFactor) throws IOException { 229 230 Args.nullNotPermitted(out, "out"); 231 Args.nullNotPermitted(chart, "chart"); 232 233 double desiredWidth = width * widthScaleFactor; 234 double desiredHeight = height * heightScaleFactor; 235 double defaultWidth = width; 236 double defaultHeight = height; 237 boolean scale = false; 238 239 // get desired width and height from somewhere then... 240 if ((widthScaleFactor != 1) || (heightScaleFactor != 1)) { 241 scale = true; 242 } 243 244 double scaleX = desiredWidth / defaultWidth; 245 double scaleY = desiredHeight / defaultHeight; 246 247 BufferedImage image = new BufferedImage((int) desiredWidth, 248 (int) desiredHeight, BufferedImage.TYPE_INT_ARGB); 249 Graphics2D g2 = image.createGraphics(); 250 251 if (scale) { 252 AffineTransform saved = g2.getTransform(); 253 g2.transform(AffineTransform.getScaleInstance(scaleX, scaleY)); 254 chart.draw(g2, new Rectangle2D.Double(0, 0, defaultWidth, 255 defaultHeight), null, null); 256 g2.setTransform(saved); 257 g2.dispose(); 258 } 259 else { 260 chart.draw(g2, new Rectangle2D.Double(0, 0, defaultWidth, 261 defaultHeight), null, null); 262 } 263 out.write(encodeAsPNG(image)); 264 265 } 266 267 /** 268 * Saves a chart to the specified file in PNG format. 269 * 270 * @param file the file name ({@code null} not permitted). 271 * @param chart the chart ({@code null} not permitted). 272 * @param width the image width. 273 * @param height the image height. 274 * 275 * @throws IOException if there are any I/O errors. 276 */ 277 public static void saveChartAsPNG(File file, JFreeChart chart, 278 int width, int height) throws IOException { 279 280 // defer argument checking... 281 saveChartAsPNG(file, chart, width, height, null); 282 283 } 284 285 /** 286 * Saves a chart to a file in PNG format. This method allows you to pass 287 * in a {@link ChartRenderingInfo} object, to collect information about the 288 * chart dimensions/entities. You will need this info if you want to 289 * create an HTML image map. 290 * 291 * @param file the file ({@code null} not permitted). 292 * @param chart the chart ({@code null} not permitted). 293 * @param width the image width. 294 * @param height the image height. 295 * @param info the chart rendering info ({@code null} permitted). 296 * 297 * @throws IOException if there are any I/O errors. 298 */ 299 public static void saveChartAsPNG(File file, JFreeChart chart, 300 int width, int height, ChartRenderingInfo info) 301 throws IOException { 302 303 Args.nullNotPermitted(file, "file"); 304 try (OutputStream out = new BufferedOutputStream(new FileOutputStream(file))) { 305 ChartUtils.writeChartAsPNG(out, chart, width, height, info); 306 } 307 } 308 309 /** 310 * Saves a chart to a file in PNG format. This method allows you to pass 311 * in a {@link ChartRenderingInfo} object, to collect information about the 312 * chart dimensions/entities. You will need this info if you want to 313 * create an HTML image map. 314 * 315 * @param file the file ({@code null} not permitted). 316 * @param chart the chart ({@code null} not permitted). 317 * @param width the image width. 318 * @param height the image height. 319 * @param info the chart rendering info ({@code null} permitted). 320 * @param encodeAlpha encode alpha? 321 * @param compression the PNG compression level (0-9). 322 * 323 * @throws IOException if there are any I/O errors. 324 */ 325 public static void saveChartAsPNG(File file, JFreeChart chart, 326 int width, int height, ChartRenderingInfo info, boolean encodeAlpha, 327 int compression) throws IOException { 328 329 Args.nullNotPermitted(file, "file"); 330 Args.nullNotPermitted(chart, "chart"); 331 try (OutputStream out = new BufferedOutputStream(new FileOutputStream(file))) { 332 writeChartAsPNG(out, chart, width, height, info, encodeAlpha, compression); 333 } 334 335 } 336 337 /** 338 * Writes a chart to an output stream in JPEG format. Please note that 339 * JPEG is a poor format for chart images, use PNG if possible. 340 * 341 * @param out the output stream ({@code null} not permitted). 342 * @param chart the chart ({@code null} not permitted). 343 * @param width the image width. 344 * @param height the image height. 345 * 346 * @throws IOException if there are any I/O errors. 347 */ 348 public static void writeChartAsJPEG(OutputStream out, 349 JFreeChart chart, int width, int height) throws IOException { 350 351 // defer argument checking... 352 writeChartAsJPEG(out, chart, width, height, null); 353 354 } 355 356 /** 357 * Writes a chart to an output stream in JPEG format. Please note that 358 * JPEG is a poor format for chart images, use PNG if possible. 359 * 360 * @param out the output stream ({@code null} not permitted). 361 * @param quality the quality setting. 362 * @param chart the chart ({@code null} not permitted). 363 * @param width the image width. 364 * @param height the image height. 365 * 366 * @throws IOException if there are any I/O errors. 367 */ 368 public static void writeChartAsJPEG(OutputStream out, float quality, 369 JFreeChart chart, int width, int height) throws IOException { 370 371 // defer argument checking... 372 ChartUtils.writeChartAsJPEG(out, quality, chart, width, height, 373 null); 374 375 } 376 377 /** 378 * Writes a chart to an output stream in JPEG format. This method allows 379 * you to pass in a {@link ChartRenderingInfo} object, to collect 380 * information about the chart dimensions/entities. You will need this 381 * info if you want to create an HTML image map. 382 * 383 * @param out the output stream ({@code null} not permitted). 384 * @param chart the chart ({@code null} not permitted). 385 * @param width the image width. 386 * @param height the image height. 387 * @param info the chart rendering info ({@code null} permitted). 388 * 389 * @throws IOException if there are any I/O errors. 390 */ 391 public static void writeChartAsJPEG(OutputStream out, JFreeChart chart, 392 int width, int height, ChartRenderingInfo info) 393 throws IOException { 394 395 Args.nullNotPermitted(out, "out"); 396 Args.nullNotPermitted(chart, "chart"); 397 BufferedImage image = chart.createBufferedImage(width, height, 398 BufferedImage.TYPE_INT_RGB, info); 399 EncoderUtil.writeBufferedImage(image, ImageFormat.JPEG, out); 400 401 } 402 403 /** 404 * Writes a chart to an output stream in JPEG format. This method allows 405 * you to pass in a {@link ChartRenderingInfo} object, to collect 406 * information about the chart dimensions/entities. You will need this 407 * info if you want to create an HTML image map. 408 * 409 * @param out the output stream ({@code null} not permitted). 410 * @param quality the output quality (0.0f to 1.0f). 411 * @param chart the chart ({@code null} not permitted). 412 * @param width the image width. 413 * @param height the image height. 414 * @param info the chart rendering info ({@code null} permitted). 415 * 416 * @throws IOException if there are any I/O errors. 417 */ 418 public static void writeChartAsJPEG(OutputStream out, float quality, 419 JFreeChart chart, int width, int height, ChartRenderingInfo info) 420 throws IOException { 421 422 Args.nullNotPermitted(out, "out"); 423 Args.nullNotPermitted(chart, "chart"); 424 BufferedImage image = chart.createBufferedImage(width, height, 425 BufferedImage.TYPE_INT_RGB, info); 426 EncoderUtil.writeBufferedImage(image, ImageFormat.JPEG, out, quality); 427 428 } 429 430 /** 431 * Saves a chart to a file in JPEG format. 432 * 433 * @param file the file ({@code null} not permitted). 434 * @param chart the chart ({@code null} not permitted). 435 * @param width the image width. 436 * @param height the image height. 437 * 438 * @throws IOException if there are any I/O errors. 439 */ 440 public static void saveChartAsJPEG(File file, JFreeChart chart, 441 int width, int height) throws IOException { 442 443 // defer argument checking... 444 saveChartAsJPEG(file, chart, width, height, null); 445 446 } 447 448 /** 449 * Saves a chart to a file in JPEG format. 450 * 451 * @param file the file ({@code null} not permitted). 452 * @param quality the JPEG quality setting. 453 * @param chart the chart ({@code null} not permitted). 454 * @param width the image width. 455 * @param height the image height. 456 * 457 * @throws IOException if there are any I/O errors. 458 */ 459 public static void saveChartAsJPEG(File file, float quality, 460 JFreeChart chart, int width, int height) throws IOException { 461 462 // defer argument checking... 463 saveChartAsJPEG(file, quality, chart, width, height, null); 464 465 } 466 467 /** 468 * Saves a chart to a file in JPEG format. This method allows you to pass 469 * in a {@link ChartRenderingInfo} object, to collect information about the 470 * chart dimensions/entities. You will need this info if you want to 471 * create an HTML image map. 472 * 473 * @param file the file name ({@code null} not permitted). 474 * @param chart the chart ({@code null} not permitted). 475 * @param width the image width. 476 * @param height the image height. 477 * @param info the chart rendering info ({@code null} permitted). 478 * 479 * @throws IOException if there are any I/O errors. 480 */ 481 public static void saveChartAsJPEG(File file, JFreeChart chart, 482 int width, int height, ChartRenderingInfo info) throws IOException { 483 484 Args.nullNotPermitted(file, "file"); 485 Args.nullNotPermitted(chart, "chart"); 486 try (OutputStream out = new BufferedOutputStream(new FileOutputStream(file))) { 487 writeChartAsJPEG(out, chart, width, height, info); 488 } 489 490 } 491 492 /** 493 * Saves a chart to a file in JPEG format. This method allows you to pass 494 * in a {@link ChartRenderingInfo} object, to collect information about the 495 * chart dimensions/entities. You will need this info if you want to 496 * create an HTML image map. 497 * 498 * @param file the file name ({@code null} not permitted). 499 * @param quality the quality setting. 500 * @param chart the chart ({@code null} not permitted). 501 * @param width the image width. 502 * @param height the image height. 503 * @param info the chart rendering info ({@code null} permitted). 504 * 505 * @throws IOException if there are any I/O errors. 506 */ 507 public static void saveChartAsJPEG(File file, float quality, 508 JFreeChart chart, int width, int height, 509 ChartRenderingInfo info) throws IOException { 510 511 Args.nullNotPermitted(file, "file"); 512 Args.nullNotPermitted(chart, "chart"); 513 try (OutputStream out = new BufferedOutputStream(new FileOutputStream(file))) { 514 writeChartAsJPEG(out, quality, chart, width, height, info); 515 } 516 517 } 518 519 /** 520 * Writes a {@link BufferedImage} to an output stream in JPEG format. 521 * 522 * @param out the output stream ({@code null} not permitted). 523 * @param image the image ({@code null} not permitted). 524 * 525 * @throws IOException if there are any I/O errors. 526 */ 527 public static void writeBufferedImageAsJPEG(OutputStream out, 528 BufferedImage image) throws IOException { 529 530 // defer argument checking... 531 writeBufferedImageAsJPEG(out, 0.75f, image); 532 533 } 534 535 /** 536 * Writes a {@link BufferedImage} to an output stream in JPEG format. 537 * 538 * @param out the output stream ({@code null} not permitted). 539 * @param quality the image quality (0.0f to 1.0f). 540 * @param image the image ({@code null} not permitted). 541 * 542 * @throws IOException if there are any I/O errors. 543 */ 544 public static void writeBufferedImageAsJPEG(OutputStream out, float quality, 545 BufferedImage image) throws IOException { 546 547 EncoderUtil.writeBufferedImage(image, ImageFormat.JPEG, out, quality); 548 549 } 550 551 /** 552 * Writes a {@link BufferedImage} to an output stream in PNG format. 553 * 554 * @param out the output stream ({@code null} not permitted). 555 * @param image the image ({@code null} not permitted). 556 * 557 * @throws IOException if there are any I/O errors. 558 */ 559 public static void writeBufferedImageAsPNG(OutputStream out, 560 BufferedImage image) throws IOException { 561 562 EncoderUtil.writeBufferedImage(image, ImageFormat.PNG, out); 563 564 } 565 566 /** 567 * Writes a {@link BufferedImage} to an output stream in PNG format. 568 * 569 * @param out the output stream ({@code null} not permitted). 570 * @param image the image ({@code null} not permitted). 571 * @param encodeAlpha encode alpha? 572 * @param compression the compression level (0-9). 573 * 574 * @throws IOException if there are any I/O errors. 575 */ 576 public static void writeBufferedImageAsPNG(OutputStream out, 577 BufferedImage image, boolean encodeAlpha, int compression) 578 throws IOException { 579 580 EncoderUtil.writeBufferedImage(image, ImageFormat.PNG, out, 581 compression, encodeAlpha); 582 } 583 584 /** 585 * Encodes a {@link BufferedImage} to PNG format. 586 * 587 * @param image the image ({@code null} not permitted). 588 * 589 * @return A byte array in PNG format. 590 * 591 * @throws IOException if there is an I/O problem. 592 */ 593 public static byte[] encodeAsPNG(BufferedImage image) throws IOException { 594 return EncoderUtil.encode(image, ImageFormat.PNG); 595 } 596 597 /** 598 * Encodes a {@link BufferedImage} to PNG format. 599 * 600 * @param image the image ({@code null} not permitted). 601 * @param encodeAlpha encode alpha? 602 * @param compression the PNG compression level (0-9). 603 * 604 * @return The byte array in PNG format. 605 * 606 * @throws IOException if there is an I/O problem. 607 */ 608 public static byte[] encodeAsPNG(BufferedImage image, boolean encodeAlpha, 609 int compression) throws IOException { 610 return EncoderUtil.encode(image, ImageFormat.PNG, compression, 611 encodeAlpha); 612 } 613 614 /** 615 * Writes an image map to an output stream. 616 * 617 * @param writer the writer ({@code null} not permitted). 618 * @param name the map name ({@code null} not permitted). 619 * @param info the chart rendering info ({@code null} not permitted). 620 * @param useOverLibForToolTips whether to use OverLIB for tooltips 621 * (http://www.bosrup.com/web/overlib/). 622 * 623 * @throws IOException if there are any I/O errors. 624 */ 625 public static void writeImageMap(PrintWriter writer, String name, 626 ChartRenderingInfo info, boolean useOverLibForToolTips) 627 throws IOException { 628 629 ToolTipTagFragmentGenerator toolTipTagFragmentGenerator; 630 if (useOverLibForToolTips) { 631 toolTipTagFragmentGenerator 632 = new OverLIBToolTipTagFragmentGenerator(); 633 } 634 else { 635 toolTipTagFragmentGenerator 636 = new StandardToolTipTagFragmentGenerator(); 637 } 638 ImageMapUtils.writeImageMap(writer, name, info, 639 toolTipTagFragmentGenerator, 640 new StandardURLTagFragmentGenerator()); 641 642 } 643 644 /** 645 * Writes an image map to the specified writer. 646 * 647 * @param writer the writer ({@code null} not permitted). 648 * @param name the map name ({@code null} not permitted). 649 * @param info the chart rendering info ({@code null} not permitted). 650 * @param toolTipTagFragmentGenerator a generator for the HTML fragment 651 * that will contain the tooltip text ({@code null} not permitted 652 * if {@code info} contains tooltip information). 653 * @param urlTagFragmentGenerator a generator for the HTML fragment that 654 * will contain the URL reference ({@code null} not permitted if 655 * {@code info} contains URLs). 656 * 657 * @throws IOException if there are any I/O errors. 658 */ 659 public static void writeImageMap(PrintWriter writer, String name, 660 ChartRenderingInfo info, 661 ToolTipTagFragmentGenerator toolTipTagFragmentGenerator, 662 URLTagFragmentGenerator urlTagFragmentGenerator) 663 throws IOException { 664 665 writer.println(ImageMapUtils.getImageMap(name, info, 666 toolTipTagFragmentGenerator, urlTagFragmentGenerator)); 667 } 668 669 /** 670 * Creates an HTML image map. This method maps to 671 * {@link ImageMapUtils#getImageMap(String, ChartRenderingInfo, 672 * ToolTipTagFragmentGenerator, URLTagFragmentGenerator)}, using default 673 * generators. 674 * 675 * @param name the map name ({@code null} not permitted). 676 * @param info the chart rendering info ({@code null} not permitted). 677 * 678 * @return The map tag. 679 */ 680 public static String getImageMap(String name, ChartRenderingInfo info) { 681 return ImageMapUtils.getImageMap(name, info, 682 new StandardToolTipTagFragmentGenerator(), 683 new StandardURLTagFragmentGenerator()); 684 } 685 686 /** 687 * Creates an HTML image map. This method maps directly to 688 * {@link ImageMapUtils#getImageMap(String, ChartRenderingInfo, 689 * ToolTipTagFragmentGenerator, URLTagFragmentGenerator)}. 690 * 691 * @param name the map name ({@code null} not permitted). 692 * @param info the chart rendering info ({@code null} not permitted). 693 * @param toolTipTagFragmentGenerator a generator for the HTML fragment 694 * that will contain the tooltip text ({@code null} not permitted 695 * if {@code info} contains tooltip information). 696 * @param urlTagFragmentGenerator a generator for the HTML fragment that 697 * will contain the URL reference ({@code null} not permitted if 698 * {@code info} contains URLs). 699 * 700 * @return The map tag. 701 */ 702 public static String getImageMap(String name, ChartRenderingInfo info, 703 ToolTipTagFragmentGenerator toolTipTagFragmentGenerator, 704 URLTagFragmentGenerator urlTagFragmentGenerator) { 705 706 return ImageMapUtils.getImageMap(name, info, 707 toolTipTagFragmentGenerator, urlTagFragmentGenerator); 708 709 } 710 711}