How to add a horizontal line to a bar chart?
Quick question that's been stumping me. I'm displaying some data in a stacked bar chart, where the total height of the stack should be compared to a target value. How can I draw a horizontal line on the chart to represent that target?
Thanks,
Chris
Thanks,
Chris
0
Comments
-
Hi,
This is pretty straightforward. On your stacked bar chart (or bar chart for that matter), go to the "Format Chart" tab of the wizard. Click on Y-Series (under the "Chart Area" on the left). Then click on the "Markers" button to add your marker.
I have attached a report design that does this. It uses the sample data base. A yellow line is added to the stacked bar chart.
Good Luck!Warning No formatter is installed for the format ipb0 -
I do not see a way to bind the target to a parameter. That does sound like a better way to do it though.<br />
<br />
I filed an enhancement request to have it looked at. You can track it here: <br />
<br />
<a class='bbc_url' href='http://ted.birt-exchange.com/show_bug.cgi?id=61'>Redirecting to BIRT Exchange</a>Warning No formatter is installed for the format ipb0 -
Bit of a bruising syntax-wrangling session, but I eventually met Rhino and pieced together enough documentation to come up with the following code for the onRender script of the chart:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
importPackage(Packages.org.eclipse.birt.chart.model.data.impl);
function beforeDrawMarkerLine( axis, markerLine, icsc ) {
target = icsc.getExternalContext().getScriptable().getParameterValue("total_target");
markerLine.setValue(NumberDataElementImpl.create(target));
}</pre>
<br />
which changes the line position at runtime.0 -
Hi,
is "total_target" in the script is a global variable? I am getting error when I pass dataset variable in the getParameterValue () method. Can you please let me know how can I declare/pass backend table column to the getParameterValue method.
Thanks,
Susmitha.0 -
total_target is a report parameter. Since icsc.getExternalContext().getScriptable() returns an IReportContext ( see <a class='bbc_url' href='http://www.birt-exchange.org/documentation/BIRT_220/EngineJavadoc/enginescript/api/index.html'>Birt Script API</a>) you could use getGlobalVariable() to get a global variable.<br />
<br />
I'm not sure about computing a marker line from the dataset -- don't know if the data series values are available when the line is drawn. If they are, I guess you could use the afterDataSetFilled event to compute a value and store it in a global variable for use by beforeDrawMarkerLine?0
Categories
- All Categories
- 123 Developer Announcements
- 54 Articles
- 151 General Questions
- 148 Thrust Services
- 57 OpenText Hackathon
- 37 Developer Tools
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 918 Core Messaging
- 84 Digital Asset Management
- 9.4K Documentum
- 32 eDOCS
- 186 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 8 XM Fax
- Follow Categories