Hi everyone,
I am looking for a way to generate a Box Plot within the Ignition Report Module.
As shown in the attached image , we need to visualize power distribution (kW) across multiple Racks and have a requirement to include this exact visualization in a scheduled PDF report.
My Questions:
-
Has anyone successfully created a Box Plot in the Report Module?
-
If you've done this before, would you mind sharing a snippet or a general approach on how to structure the data for the chart?
-
Are there any reputable third-party modules that add advanced statistical charting like Box Plots to the Report Module?
Any advice, screenshots, or sample would be greatly appreciated!
Start with a bar chart and use the BoxAndWhiskerRenderer.
You might need to tweak the chart with the configureChart() scripting method.
Hi @pturmel,
I'm trying to implement a Box Plot in the Report Module following your suggestion to use a Bar Chart with a BoxAndWhiskerRenderer.
The chart renders the axes correctly, but the plot area remains empty (no boxes). I've attempted to force the dataset binding within configureChart(), but it hasn't resolved the issue.
Could you please check if my script logic for the BoxAndWhiskerCategoryDataset or the renderer hand-off is incorrect?
1. Script Data Source (updateData)
Python
def updateData(data, sample):
# Import specialized dataset for Box Plots
from org.jfree.data.statistics import DefaultBoxAndWhiskerCategoryDataset
# Initialize the dataset
ds = DefaultBoxAndWhiskerCategoryDataset()
# Static debug data: [Min, Q1, Median, Q3, Max] represented by a list
test_values = [5, 7, 8, 10, 12, 15, 18, 20, 22, 25]
# Add data: (List of values, Series, Category)
ds.add(test_values, "Power", "Rack 01")
# Pass to the report data map
data['debugData'] = ds
2. Bar Chart Extension Function (configureChart)
Python
def configureChart(self, chart):
from org.jfree.chart.renderer.category import BoxAndWhiskerRenderer
import java.awt.Color
plot = chart.getCategoryPlot()
# Retrieve the dataset from the report data map
ds = self.data.get("debugData")
if ds:
# Explicitly set the dataset to the plot
plot.setDataset(ds)
# Initialize and configure the BoxAndWhisker renderer
renderer = BoxAndWhiskerRenderer()
renderer.setFillBox(True)
renderer.setSeriesPaint(0, java.awt.Color.WHITE)
renderer.setArtifactPaint(java.awt.Color.BLACK)
# Apply the renderer to the plot
plot.setRenderer(renderer)