What would be the best way to present a histogram to correlate with chart subplots?
See to the right of this image...
Huh. Probably have to lay a paintable canvas on top.
It's a great idea for inclusion in my NoteChart module. I'll put this on my to-do list.
Interesting, but what is the histogram trying to tell me?
It's helpful with Statistical Process Control, to "see" how tightly a signal is conforming to a setpoint.
Something quick and dirty (mostly dirty) using two charts.
Assumes all dataset names match in each chart.
Chart_plus_Histogram_2024-01-18_1444.zip (16.1 KB)
Script in button:
from collections import Counter
mainChart = event.source.parent.getComponent('Chart')
histogram = event.source.parent.getComponent('Histogram')
xyPlot = mainChart.chart.getXYPlot()
for plot in xyPlot.subplots:
datasetName = plot.dataset.name
dataIn = getattr(mainChart, datasetName)
counter = Counter(dataIn.getColumnAsList(1))
dataOut = [[key, val] for key, val in sorted(counter.items())]
setattr(histogram, datasetName, system.dataset.toDataSet(['x','y'], dataOut))
5 Likes