0
# Rendering and Styling
1
2
Renderer interfaces and implementations that control how data is visually represented. Renderers are responsible for drawing data items, managing colors, shapes, strokes, and providing interactive features like tooltips and item labels.
3
4
## Capabilities
5
6
### Category Item Renderers
7
8
Renderers for category-based charts that control how data items are drawn in CategoryPlot.
9
10
```java { .api }
11
/**
12
* Interface for rendering items in category plots
13
*/
14
public interface CategoryItemRenderer extends LegendItemSource {
15
/**
16
* Returns the number of passes required by the renderer
17
* @return the pass count
18
*/
19
public int getPassCount();
20
21
/**
22
* Returns the plot that the renderer is assigned to
23
* @return the plot
24
*/
25
public CategoryPlot getPlot();
26
27
/**
28
* Sets the plot that the renderer is assigned to
29
* @param plot the plot
30
*/
31
public void setPlot(CategoryPlot plot);
32
33
/**
34
* Draws a single data item
35
* @param g2 the graphics device
36
* @param state the renderer state
37
* @param dataArea the area within which the data is being drawn
38
* @param plot the plot (can be used to obtain standard color information etc)
39
* @param domainAxis the domain axis
40
* @param rangeAxis the range axis
41
* @param dataset the dataset
42
* @param row the row index (zero-based)
43
* @param column the column index (zero-based)
44
* @param pass the pass index
45
*/
46
public void drawItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset dataset, int row, int column, int pass);
47
48
// Visibility control
49
public boolean getItemVisible(int series, int item);
50
public Boolean getSeriesVisible(int series);
51
public void setSeriesVisible(int series, Boolean visible);
52
public Boolean getSeriesVisibleInLegend(int series);
53
public void setSeriesVisibleInLegend(int series, Boolean visible);
54
public boolean getDefaultSeriesVisible();
55
public void setDefaultSeriesVisible(boolean visible);
56
57
// Paint (color) control
58
public Paint getItemPaint(int row, int column);
59
public Paint getSeriesPaint(int series);
60
public void setSeriesPaint(int series, Paint paint);
61
public Paint getDefaultPaint();
62
public void setDefaultPaint(Paint paint);
63
64
// Outline paint control
65
public Paint getItemOutlinePaint(int row, int column);
66
public Paint getSeriesOutlinePaint(int series);
67
public void setSeriesOutlinePaint(int series, Paint paint);
68
public Paint getDefaultOutlinePaint();
69
public void setDefaultOutlinePaint(Paint paint);
70
71
// Stroke control
72
public Stroke getItemStroke(int row, int column);
73
public Stroke getSeriesStroke(int series);
74
public void setSeriesStroke(int series, Stroke stroke);
75
public Stroke getDefaultStroke();
76
public void setDefaultStroke(Stroke stroke);
77
78
// Outline stroke control
79
public Stroke getItemOutlineStroke(int row, int column);
80
public Stroke getSeriesOutlineStroke(int series);
81
public void setSeriesOutlineStroke(int series, Stroke stroke);
82
public Stroke getDefaultOutlineStroke();
83
public void setDefaultOutlineStroke(Stroke stroke);
84
85
// Shape control
86
public Shape getItemShape(int row, int column);
87
public Shape getSeriesShape(int series);
88
public void setSeriesShape(int series, Shape shape);
89
public Shape getDefaultShape();
90
public void setDefaultShape(Shape shape);
91
92
// Item label control
93
public boolean getItemLabelVisible(int series, int item);
94
public Boolean getSeriesItemLabelsVisible(int series);
95
public void setSeriesItemLabelsVisible(int series, Boolean visible);
96
public boolean getDefaultItemLabelsVisible();
97
public void setDefaultItemLabelsVisible(boolean visible);
98
99
// Label generators and positioning
100
public CategoryItemLabelGenerator getItemLabelGenerator(int row, int column);
101
public CategoryItemLabelGenerator getSeriesItemLabelGenerator(int series);
102
public void setSeriesItemLabelGenerator(int series, CategoryItemLabelGenerator generator);
103
public CategoryItemLabelGenerator getDefaultItemLabelGenerator();
104
public void setDefaultItemLabelGenerator(CategoryItemLabelGenerator generator);
105
106
public ItemLabelPosition getPositiveItemLabelPosition(int row, int column);
107
public ItemLabelPosition getSeriesPositiveItemLabelPosition(int series);
108
public void setSeriesPositiveItemLabelPosition(int series, ItemLabelPosition position);
109
public ItemLabelPosition getDefaultPositiveItemLabelPosition();
110
public void setDefaultPositiveItemLabelPosition(ItemLabelPosition position);
111
112
public ItemLabelPosition getNegativeItemLabelPosition(int row, int column);
113
public ItemLabelPosition getSeriesNegativeItemLabelPosition(int series);
114
public void setSeriesNegativeItemLabelPosition(int series, ItemLabelPosition position);
115
public ItemLabelPosition getDefaultNegativeItemLabelPosition();
116
public void setDefaultNegativeItemLabelPosition(ItemLabelPosition position);
117
118
// Tooltip control
119
public CategoryToolTipGenerator getToolTipGenerator(int row, int column);
120
public CategoryToolTipGenerator getSeriesToolTipGenerator(int series);
121
public void setSeriesToolTipGenerator(int series, CategoryToolTipGenerator generator);
122
public CategoryToolTipGenerator getDefaultToolTipGenerator();
123
public void setDefaultToolTipGenerator(CategoryToolTipGenerator generator);
124
125
// URL control
126
public CategoryURLGenerator getItemURLGenerator(int row, int column);
127
public CategoryURLGenerator getSeriesItemURLGenerator(int series);
128
public void setSeriesItemURLGenerator(int series, CategoryURLGenerator generator);
129
public CategoryURLGenerator getDefaultItemURLGenerator();
130
public void setDefaultItemURLGenerator(CategoryURLGenerator generator);
131
}
132
133
/**
134
* Standard bar chart renderer
135
*/
136
public class BarRenderer extends AbstractCategoryItemRenderer {
137
/**
138
* Creates a new bar renderer
139
*/
140
public BarRenderer();
141
142
// Bar appearance
143
public double getItemMargin();
144
public void setItemMargin(double percent);
145
public boolean getDrawBarOutline();
146
public void setDrawBarOutline(boolean draw);
147
public double getMaximumBarWidth();
148
public void setMaximumBarWidth(double percent);
149
public double getMinimumBarLength();
150
public void setMinimumBarLength(double length);
151
public GradientPaintTransformer getGradientPaintTransformer();
152
public void setGradientPaintTransformer(GradientPaintTransformer transformer);
153
154
// Shadows and 3D effects
155
public boolean getShadowsVisible();
156
public void setShadowsVisible(boolean visible);
157
public Paint getShadowPaint();
158
public void setShadowPaint(Paint paint);
159
public double getShadowXOffset();
160
public void setShadowXOffset(double offset);
161
public double getShadowYOffset();
162
public void setShadowYOffset(double offset);
163
164
// Base value
165
public double getBase();
166
public void setBase(double base);
167
public boolean getIncludeBaseInRange();
168
public void setIncludeBaseInRange(boolean include);
169
}
170
171
/**
172
* Stacked bar chart renderer
173
*/
174
public class StackedBarRenderer extends BarRenderer {
175
/**
176
* Creates a new stacked bar renderer
177
*/
178
public StackedBarRenderer();
179
180
/**
181
* Creates a new stacked bar renderer with percentage display option
182
* @param renderAsPercentages flag to render values as percentages
183
*/
184
public StackedBarRenderer(boolean renderAsPercentages);
185
186
public boolean getRenderAsPercentages();
187
public void setRenderAsPercentages(boolean asPercentages);
188
}
189
190
/**
191
* Line and shape renderer for category plots
192
*/
193
public class LineAndShapeRenderer extends AbstractCategoryItemRenderer {
194
/**
195
* Creates a new line and shape renderer
196
*/
197
public LineAndShapeRenderer();
198
199
/**
200
* Creates a new line and shape renderer with display options
201
* @param lines flag to draw lines between points
202
* @param shapes flag to draw shapes at data points
203
*/
204
public LineAndShapeRenderer(boolean lines, boolean shapes);
205
206
// Line visibility
207
public Boolean getSeriesLinesVisible(int series);
208
public void setSeriesLinesVisible(int series, Boolean flag);
209
public boolean getDefaultLinesVisible();
210
public void setDefaultLinesVisible(boolean flag);
211
212
// Shape visibility
213
public Boolean getSeriesShapesVisible(int series);
214
public void setSeriesShapesVisible(int series, Boolean flag);
215
public boolean getDefaultShapesVisible();
216
public void setDefaultShapesVisible(boolean flag);
217
218
// Shape filling
219
public Boolean getSeriesShapesFilled(int series);
220
public void setSeriesShapesFilled(int series, Boolean flag);
221
public boolean getDefaultShapesFilled();
222
public void setDefaultShapesFilled(boolean flag);
223
224
// Advanced line drawing
225
public boolean getDrawOutlines();
226
public void setDrawOutlines(boolean flag);
227
public boolean getUseOutlinePaint();
228
public void setUseOutlinePaint(boolean use);
229
public boolean getUseFillPaint();
230
public void setUseFillPaint(boolean use);
231
}
232
```
233
234
**Usage Example:**
235
236
```java
237
import org.jfree.chart.renderer.category.*;
238
import java.awt.*;
239
240
// Customize bar renderer
241
CategoryPlot plot = chart.getCategoryPlot();
242
BarRenderer renderer = (BarRenderer) plot.getRenderer();
243
244
// Set colors for different series
245
renderer.setSeriesPaint(0, Color.BLUE);
246
renderer.setSeriesPaint(1, Color.RED);
247
renderer.setSeriesPaint(2, Color.GREEN);
248
249
// Configure bar appearance
250
renderer.setItemMargin(0.1); // 10% margin between items
251
renderer.setDrawBarOutline(true); // Draw outlines around bars
252
renderer.setSeriesOutlinePaint(0, Color.BLACK);
253
renderer.setMaximumBarWidth(0.8); // Maximum 80% of available space
254
255
// Enable shadows
256
renderer.setShadowsVisible(true);
257
renderer.setShadowPaint(Color.GRAY);
258
renderer.setShadowXOffset(2.0);
259
renderer.setShadowYOffset(2.0);
260
261
// Configure item labels
262
renderer.setDefaultItemLabelsVisible(true);
263
renderer.setDefaultItemLabelGenerator(new StandardCategoryItemLabelGenerator());
264
renderer.setDefaultPositiveItemLabelPosition(
265
new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
266
```
267
268
### XY Item Renderers
269
270
Renderers for XY plots that control how data points are drawn in scatter plots, line charts, and time series.
271
272
```java { .api }
273
/**
274
* Interface for rendering items in XY plots
275
*/
276
public interface XYItemRenderer extends LegendItemSource {
277
/**
278
* Returns the number of passes required by the renderer
279
* @return the pass count
280
*/
281
public int getPassCount();
282
283
/**
284
* Returns the plot that the renderer is assigned to
285
* @return the plot
286
*/
287
public XYPlot getPlot();
288
289
/**
290
* Sets the plot that the renderer is assigned to
291
* @param plot the plot
292
*/
293
public void setPlot(XYPlot plot);
294
295
/**
296
* Draws a single data item
297
* @param g2 the graphics device
298
* @param state the renderer state
299
* @param dataArea the area within which the data is being drawn
300
* @param info collects plot rendering info
301
* @param plot the plot (can be used to obtain standard color information etc)
302
* @param domainAxis the domain axis
303
* @param rangeAxis the range axis
304
* @param dataset the dataset
305
* @param series the series index (zero-based)
306
* @param item the item index (zero-based)
307
* @param crosshairState crosshair information for the plot
308
* @param pass the pass index
309
*/
310
public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass);
311
312
// Grid band filling
313
public void fillDomainGridBand(Graphics2D g2, XYPlot plot, ValueAxis axis, Rectangle2D dataArea, double start, double end);
314
public void fillRangeGridBand(Graphics2D g2, XYPlot plot, ValueAxis axis, Rectangle2D dataArea, double start, double end);
315
316
// Visibility control (similar to CategoryItemRenderer)
317
public boolean getItemVisible(int series, int item);
318
public Boolean getSeriesVisible(int series);
319
public void setSeriesVisible(int series, Boolean visible);
320
public boolean getDefaultSeriesVisible();
321
public void setDefaultSeriesVisible(boolean visible);
322
323
// Paint control
324
public Paint getItemPaint(int series, int item);
325
public Paint getSeriesPaint(int series);
326
public void setSeriesPaint(int series, Paint paint);
327
public Paint getDefaultPaint();
328
public void setDefaultPaint(Paint paint);
329
330
// Stroke control
331
public Stroke getItemStroke(int series, int item);
332
public Stroke getSeriesStroke(int series);
333
public void setSeriesStroke(int series, Stroke stroke);
334
public Stroke getDefaultStroke();
335
public void setDefaultStroke(Stroke stroke);
336
337
// Shape control
338
public Shape getItemShape(int series, int item);
339
public Shape getSeriesShape(int series);
340
public void setSeriesShape(int series, Shape shape);
341
public Shape getDefaultShape();
342
public void setDefaultShape(Shape shape);
343
344
// Item label control
345
public XYItemLabelGenerator getItemLabelGenerator(int series, int item);
346
public XYItemLabelGenerator getSeriesItemLabelGenerator(int series);
347
public void setSeriesItemLabelGenerator(int series, XYItemLabelGenerator generator);
348
public XYItemLabelGenerator getDefaultItemLabelGenerator();
349
public void setDefaultItemLabelGenerator(XYItemLabelGenerator generator);
350
351
// Tooltip control
352
public XYToolTipGenerator getToolTipGenerator(int series, int item);
353
public XYToolTipGenerator getSeriesToolTipGenerator(int series);
354
public void setSeriesToolTipGenerator(int series, XYToolTipGenerator generator);
355
public XYToolTipGenerator getDefaultToolTipGenerator();
356
public void setDefaultToolTipGenerator(XYToolTipGenerator generator);
357
358
// URL control
359
public XYURLGenerator getURLGenerator();
360
public void setURLGenerator(XYURLGenerator urlGenerator);
361
}
362
363
/**
364
* Line and shape renderer for XY plots
365
*/
366
public class XYLineAndShapeRenderer extends AbstractXYItemRenderer {
367
/**
368
* Creates a new XY line and shape renderer
369
*/
370
public XYLineAndShapeRenderer();
371
372
/**
373
* Creates a new XY line and shape renderer with display options
374
* @param lines flag to draw lines between points
375
* @param shapes flag to draw shapes at data points
376
*/
377
public XYLineAndShapeRenderer(boolean lines, boolean shapes);
378
379
// Line visibility
380
public Boolean getSeriesLinesVisible(int series);
381
public void setSeriesLinesVisible(int series, Boolean flag);
382
public boolean getDefaultLinesVisible();
383
public void setDefaultLinesVisible(boolean flag);
384
385
// Shape visibility
386
public Boolean getSeriesShapesVisible(int series);
387
public void setSeriesShapesVisible(int series, Boolean flag);
388
public boolean getDefaultShapesVisible();
389
public void setDefaultShapesVisible(boolean flag);
390
391
// Shape filling
392
public Boolean getSeriesShapesFilled(int series);
393
public void setSeriesShapesFilled(int series, Boolean flag);
394
public boolean getDefaultShapesFilled();
395
public void setDefaultShapesFilled(boolean flag);
396
397
// Advanced drawing options
398
public boolean getDrawOutlines();
399
public void setDrawOutlines(boolean flag);
400
public boolean getDrawSeriesLineAsPath();
401
public void setDrawSeriesLineAsPath(boolean flag);
402
}
403
404
/**
405
* Area renderer for XY plots
406
*/
407
public class XYAreaRenderer extends AbstractXYItemRenderer {
408
public static final int SHAPES = 1;
409
public static final int LINES = 2;
410
public static final int SHAPES_AND_LINES = 3;
411
public static final int AREA = 4;
412
public static final int AREA_AND_SHAPES = 5;
413
414
/**
415
* Creates a new XY area renderer
416
*/
417
public XYAreaRenderer();
418
419
/**
420
* Creates a new XY area renderer with specified type
421
* @param type the type of rendering
422
*/
423
public XYAreaRenderer(int type);
424
425
public int getPlotArea();
426
public void setPlotArea(int plotArea);
427
public boolean getOutline();
428
public void setOutline(boolean show);
429
}
430
431
/**
432
* Bar renderer for XY plots
433
*/
434
public class XYBarRenderer extends AbstractXYItemRenderer {
435
/**
436
* Creates a new XY bar renderer
437
*/
438
public XYBarRenderer();
439
440
/**
441
* Creates a new XY bar renderer with margin
442
* @param margin the margin around each bar
443
*/
444
public XYBarRenderer(double margin);
445
446
public double getBase();
447
public void setBase(double base);
448
public boolean getUseYInterval();
449
public void setUseYInterval(boolean use);
450
public double getMargin();
451
public void setMargin(double margin);
452
public boolean getDrawBarOutline();
453
public void setDrawBarOutline(boolean draw);
454
public GradientPaintTransformer getGradientPaintTransformer();
455
public void setGradientPaintTransformer(GradientPaintTransformer transformer);
456
}
457
458
/**
459
* Bubble chart renderer for displaying 3D data
460
*/
461
public class XYBubbleRenderer extends AbstractXYItemRenderer {
462
public static final int SCALE_ON_BOTH_AXES = 0;
463
public static final int SCALE_ON_DOMAIN_AXIS = 1;
464
public static final int SCALE_ON_RANGE_AXIS = 2;
465
466
/**
467
* Creates a new bubble renderer
468
*/
469
public XYBubbleRenderer();
470
471
/**
472
* Creates a new bubble renderer with scaling type
473
* @param scaleType the type of scaling for bubble sizes
474
*/
475
public XYBubbleRenderer(int scaleType);
476
477
public int getScaleType();
478
public void setScaleType(int scale);
479
}
480
```
481
482
**Usage Example:**
483
484
```java
485
import org.jfree.chart.renderer.xy.*;
486
import java.awt.*;
487
488
// Customize XY line renderer
489
XYPlot plot = (XYPlot) chart.getPlot();
490
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
491
492
// Configure line appearance
493
renderer.setSeriesPaint(0, Color.BLUE);
494
renderer.setSeriesStroke(0, new BasicStroke(2.0f));
495
renderer.setSeriesLinesVisible(0, true);
496
renderer.setSeriesShapesVisible(0, true);
497
498
// Configure shapes
499
renderer.setSeriesShape(0, new Ellipse2D.Double(-3.0, -3.0, 6.0, 6.0));
500
renderer.setSeriesShapesFilled(0, true);
501
502
// Set renderer
503
plot.setRenderer(renderer);
504
505
// Configure bubble chart
506
XYBubbleRenderer bubbleRenderer = new XYBubbleRenderer(XYBubbleRenderer.SCALE_ON_BOTH_AXES);
507
bubbleRenderer.setSeriesPaint(0, new Color(255, 0, 0, 128)); // Semi-transparent red
508
plot.setRenderer(bubbleRenderer);
509
```
510
511
### Advanced Rendering Features
512
513
Advanced renderer customization including gradient fills, custom shapes, and performance optimizations.
514
515
```java { .api }
516
// Gradient paint support
517
public interface GradientPaintTransformer {
518
public GradientPaint transform(GradientPaint paint, Shape target);
519
}
520
521
public class StandardGradientPaintTransformer implements GradientPaintTransformer {
522
public static final GradientPaintTransformType VERTICAL = new GradientPaintTransformType("VERTICAL");
523
public static final GradientPaintTransformType HORIZONTAL = new GradientPaintTransformType("HORIZONTAL");
524
public static final GradientPaintTransformType CENTER_VERTICAL = new GradientPaintTransformType("CENTER_VERTICAL");
525
public static final GradientPaintTransformType CENTER_HORIZONTAL = new GradientPaintTransformType("CENTER_HORIZONTAL");
526
527
public StandardGradientPaintTransformer();
528
public StandardGradientPaintTransformer(GradientPaintTransformType type);
529
public GradientPaintTransformType getType();
530
public void setType(GradientPaintTransformType type);
531
}
532
533
// High-performance renderers for large datasets
534
public class SamplingXYLineRenderer extends AbstractXYItemRenderer {
535
/**
536
* Creates a sampling renderer for large datasets
537
*/
538
public SamplingXYLineRenderer();
539
540
public int getSeriesPixelBounding(int series);
541
public void setSeriesPixelBounding(int series, int bound);
542
public int getDefaultPixelBounding();
543
public void setDefaultPixelBounding(int bound);
544
}
545
546
public class FastScatterPlot extends Plot implements ValueAxisPlot, Pannable, Zoomable {
547
/**
548
* Creates a fast scatter plot for large datasets
549
* @param data the data array [x[], y[]]
550
* @param domainAxis the domain axis
551
* @param rangeAxis the range axis
552
*/
553
public FastScatterPlot(float[][] data, ValueAxis domainAxis, ValueAxis rangeAxis);
554
555
public float[][] getData();
556
public void setData(float[][] data);
557
public Paint getPaint();
558
public void setPaint(Paint paint);
559
public boolean getDomainGridlinesVisible();
560
public void setDomainGridlinesVisible(boolean visible);
561
public boolean getRangeGridlinesVisible();
562
public void setRangeGridlinesVisible(boolean visible);
563
}
564
565
// Custom shape creation utilities
566
public class ShapeUtilities {
567
public static Shape createDiamond(float s);
568
public static Shape createUpTriangle(float s);
569
public static Shape createDownTriangle(float s);
570
public static Shape createRegularCross(float l, float t);
571
public static Shape createDiagonalCross(float l, float t);
572
public static Shape createLineRegion(Line2D line, float width);
573
public static Rectangle2D createTranslatedRectangle2D(Rectangle2D rectangle, double transX, double transY);
574
}
575
576
// Drawing supplier for consistent appearance
577
public interface DrawingSupplier {
578
public Paint getNextPaint();
579
public Paint getNextOutlinePaint();
580
public Paint getNextFillPaint();
581
public Stroke getNextStroke();
582
public Stroke getNextOutlineStroke();
583
public Shape getNextShape();
584
}
585
586
public class DefaultDrawingSupplier implements DrawingSupplier {
587
public DefaultDrawingSupplier();
588
public DefaultDrawingSupplier(Paint[] paintSequence, Paint[] fillPaintSequence, Paint[] outlinePaintSequence, Stroke[] strokeSequence, Stroke[] outlineStrokeSequence, Shape[] shapeSequence);
589
590
public Paint[] getPaintSequence();
591
public void setPaintSequence(Paint[] sequence);
592
public Paint[] getFillPaintSequence();
593
public void setFillPaintSequence(Paint[] sequence);
594
public Shape[] getShapeSequence();
595
public void setShapeSequence(Shape[] sequence);
596
}
597
```
598
599
**Usage Example:**
600
601
```java
602
import org.jfree.chart.plot.DefaultDrawingSupplier;
603
import java.awt.*;
604
605
// Create custom drawing supplier
606
Paint[] colors = {Color.RED, Color.BLUE, Color.GREEN, Color.ORANGE};
607
Shape[] shapes = {
608
new Rectangle2D.Double(-3, -3, 6, 6),
609
new Ellipse2D.Double(-3, -3, 6, 6),
610
ShapeUtilities.createDiamond(4.0f),
611
ShapeUtilities.createUpTriangle(4.0f)
612
};
613
614
DefaultDrawingSupplier supplier = new DefaultDrawingSupplier(
615
colors, colors, colors,
616
DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
617
DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
618
shapes);
619
620
// Apply to plot
621
plot.setDrawingSupplier(supplier);
622
623
// Configure gradient fills
624
BarRenderer renderer = (BarRenderer) plot.getRenderer();
625
renderer.setSeriesPaint(0, new GradientPaint(0, 0, Color.LIGHT_BLUE, 0, 100, Color.BLUE));
626
renderer.setGradientPaintTransformer(new StandardGradientPaintTransformer(
627
StandardGradientPaintTransformer.VERTICAL));
628
629
// High-performance rendering for large datasets
630
SamplingXYLineRenderer samplingRenderer = new SamplingXYLineRenderer();
631
samplingRenderer.setDefaultPixelBounding(2); // Sample every 2 pixels
632
xyPlot.setRenderer(samplingRenderer);
633
```