1 45 46 package org.jfree.data.xy; 47 48 import org.jfree.data.general.DatasetChangeEvent; 49 import org.jfree.data.general.DatasetChangeListener; 50 51 55 public class XYBarDataset extends AbstractIntervalXYDataset 56 implements IntervalXYDataset, DatasetChangeListener { 57 58 59 private XYDataset underlying; 60 61 62 private double barWidth; 63 64 70 public XYBarDataset(XYDataset underlying, double barWidth) { 71 this.underlying = underlying; 72 this.underlying.addChangeListener(this); 73 this.barWidth = barWidth; 74 } 75 76 81 public int getSeriesCount() { 82 return this.underlying.getSeriesCount(); 83 } 84 85 93 public Comparable getSeriesKey(int series) { 94 return this.underlying.getSeriesKey(series); 95 } 96 97 104 public int getItemCount(int series) { 105 return this.underlying.getItemCount(series); 106 } 107 108 118 public Number getX(int series, int item) { 119 return this.underlying.getX(series, item); 120 } 121 122 130 public Number getY(int series, int item) { 131 return this.underlying.getY(series, item); 132 } 133 134 142 public Number getStartX(int series, int item) { 143 Number result = null; 144 Number xnum = this.underlying.getX(series, item); 145 if (xnum != null) { 146 result = new Double (xnum.doubleValue() - this.barWidth / 2.0); 147 } 148 return result; 149 } 150 151 159 public Number getEndX(int series, int item) { 160 Number result = null; 161 Number xnum = this.underlying.getX(series, item); 162 if (xnum != null) { 163 result = new Double (xnum.doubleValue() + this.barWidth / 2.0); 164 } 165 return result; 166 } 167 168 176 public Number getStartY(int series, int item) { 177 return this.underlying.getY(series, item); 178 } 179 180 188 public Number getEndY(int series, int item) { 189 return this.underlying.getY(series, item); 190 } 191 192 197 public void datasetChanged(DatasetChangeEvent event) { 198 this.notifyListeners(event); 199 } 200 201 } 202 | Popular Tags |