Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Bar Chart with no values on X-Axis
Miss_Anonymus
<p>Good Morning,</p>
<p> </p>
<p>I have the following problem: I would like to create a bar chart with an underlying JDBC data source. when I have the following result:</p>
<p> </p>
<p> </p>
<p><strong>Oranges Bananas Strawberries Cherries Apples</strong></p>
<p> </p>
<p> 5 10 14 0 7</p>
<p> </p>
<p> </p>
<p> </p>
<p>And now I would like to create a bar chart, where these values are placed on the ground and on the left is a vertical scale (the y-axis) with measure values. The values above, witch I got from the DB should be displayed in the shape of a bar in the highness of its value. The bars should be displayed side by side, and the actual number should be displayed above the bar (e.g. The organges bar: there should be displayed 5 above it). Also null values should be visible (e.g. the cherries). look at the attached file.</p>
<p> </p>
<p>How can I create this? I'm having problems with the eclipse plugin under the "select data" tab, there you can manage the value x- and y- series. But I have no actual x-values, because the bars should only be placed side by side.... What do I have to place where??</p>
<p> </p>
<p>Thanks already for your help!</p>
<p> </p>
<p> </p>
Find more posts tagged with
Comments
mwilliams
With that data, all you have to do is create a separate series for each, put a dummy value in the X-Axis field (this causes them to group together), and name your series appropriately. This is the output you get by doing that:<br><br>
Miss_Anonymus
<p>Thank you very much !!</p>
<p> </p>
<p>But how can I display the null value of some bars (in this example, the cherries), too? I found out how to display the values above the bars but not, how to do it also with the "0" ?</p>
mwilliams
I don't think there's a way to do this without scripting, but if you drop this script into your chart's script area, it should do it for you:<br><br><pre class="_prettyXprint _lang-auto _linenums:0">
function afterDataSetFilled( series, dataSet, icsc )
{
if(series.getSeriesIdentifier() != ""){
if(dataSet.getValues()[0] == 0){
dataSet.getValues()[0] = .000000001;
icsc.getExternalContext().getScriptable().setPersistentGlobalVariable(series.getSeriesIdentifier(),"not null");
}
}
}
function beforeDrawDataPointLabel( dph, label, icsc )
{
if(icsc.getExternalContext().getScriptable().getPersistentGlobalVariable(dph.getSeriesDisplayValue()) != null){
label.getCaption().setValue("0");
}
}
</pre>