I tried to rebuild 05_Reporting/01_BIRT/05_Using_KNIME_Colors_in_BIRT_Report. There is a table containing one row with columns Jahr, Klinik, Monat, Row ID with a onFetch-Script on in:
reportContext.setPersistentGlobalVariable(“Klinik”, new Packages.java.lang.String(row.Klinik));
On the chart I wrote a script
function beforeDrawDataPoint( dph, fill, icsc )
{
var scriptable = icsc.getExternalContext().getScriptable();
var clr = scriptable.getPersistentGlobalVariable(Klinik);
var basis = dph.getBaseDisplayValue();
if (basis == clr) {
fill.set(255, 0, 0);
}
}
This should compare the Label of a bar chart column with the Varible Klinik and if equal, set the column to red. What did I do wrong?
Sorry, hope this one helps. Purpose is, to highlight the selected Klinik-Bar in the Chart. Find a test-dataset in the file test_daten.txt. Thanks a lot, Dominik
<a class=“attachment” test_daten.txt (145 Bytes) Reporting-Test.knwf (18.2 KB)
Still looking at this, but one thing I noticed right away was that in the script for your chart, the Klinik variable was not in quotes. If you change the line to
var clr = scriptable.getPersistentGlobalVariable("Klinik");
the chart will render without an error, although not highlighted in a different color.
Right, the chart is shown again. Thanks for that, rookie mistake. But how do I get the selected “Klinik” pathed through the workflow variable to BIRT highlight the bar column called like “Klinik” to highlight in red? I would take any other working way too.