Home
Analytics
Optional Y Series Grouping in Chart Engine
gfriis
<p>I'm trying to figure out how to implement an Optional Y Series Grouping as seen in the Report Designer. Specifically, I would like to add a third dimension to a chart by coloring each point according to some third value. I have attached a quick sketch of what I'd like to do (ignore the numbers... they're completely wrong).</p><p> </p><p>Playing around with the report designer, it seems like the optional y series grouping can do this. If there's an easier or better way, I'm open to suggestions. It's probably worth noting that the grouping values are not known ahead of time. There can be an indefinite number of unique values in a column of data to the point where every row could have a unique value. I do not need to display a legend since there is interactivity in the chart to provide more detail.</p><p> </p><p>My question is how do I actually use this grouping feature in the Java API? I tried setting the query on the Y series definition like this, since I found someone else doing something similar:</p><pre class="_prettyXprint">Query query = QueryImpl.create("row["groupColumn"]");valueDefinition.setQuery(query);</pre><p>Then I added a named dataset containing the column values to my Y series:</p><pre class="_prettyXprint">series.setDataSet("groupColumn", groupingDataSet);</pre><p>I'm sure I'm doing this wrong, but once again, it's really hard to find examples of Chart Engine usage. The vast majority of results for any Google search are for the Report Designer.</p>
Find more posts tagged with
Comments
gfriis
<p>Ah, i see... Looks like you need to use Generator.bindData() and an expression evaluator in order for any of those row expressions to be understood. I was hoping it would be simpler than that, as we are directly assigning datasets to series instead of binding them that way. So is there any use for the named datasets?</p>
mwilliams
<p>Sorry for the delay. I'll have to take a look. What version of BIRT are you using?</p>
gfriis
<p>Chart engine 4.2.0. Just trying to figure out how to properly use the API. I have been digging around in the source code and examples, but it's pretty overwhelming...</p>
gfriis
<p>I ended up doing this by manually creating separate series. It's not pretty, and I suspect there is some performance loss (it struggles a lot with a high number of series), but it works.
mwilliams
<p>In the end, that's what BIRT does anyhow, but I'll take a look and see if I can't find a way to do this easier for you. Sorry for the delay, been very busy with other tasks lately.
</p>
mwilliams
<p>Here's the code that I was able to get this to work with.</p><pre class="_prettyXprint _linenums:0">SeriesDefinition sdGroup = SeriesDefinitionImpl.create( );Query query = QueryImpl.create( "row["ygroup"]" );sdGroup.setQuery( query ); yAxisPrimary.getSeriesDefinitions( ).clear( ); // Clear the original// Y-Series (sdY)yAxisPrimary.getSeriesDefinitions( ).add( 0, sdGroup );sdGroup.getSeries( ).add( sdY.getSeries( ).get( 0 ) );</pre><p>Hope this helps. Let me know if you need the full example.</p>
Kushal Palli
<p>Hi Michael,<br>
i am trying to build an gantt chart from birt studio. But its not exactly looking like what i expect.</p>
<p> Can you provide exact link on tutorial of building gantt chart from studio. Thanx.</p>
JFreeman
<p>Do you have to use Report Studio to create the report design or can you use the full report designer instead?</p>
<p> </p>
<p>Report Studio is great for some things but it does have some limitations on the level of customization available when creating charts as compared to using the full commercial designer.</p>
<p> </p>
<p>If something you are wanting to do is not available from the GUI menu in report studio, you can use the full report designer to build the report instead.</p>