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)
how to disable optional Y series grouping for secondary Y-Axis?
elvis_tu
Hello,
I want to show order annual sales volume and annual average price.
my data set:
[SQL]
select
year(orderdate) as orderyear,
month(orderdate) as ordermonth,
avg(d.priceeach) as avgprice,
sum(quantityordered) as volumn
from orders o, orderdetails d
where o.ordernumber = d.ordernumber
group by
year(orderdate),
month(orderdate)
[Preview]
ORDERYEAR ORDERMONTH AVGPRICE VOLUMN
2003 1 91.40461538461537 1357
2003 2 90.24878048780488 1449
2003 3 90.7974 1755
2003 4 91.09862068965516 1993
2003 5 90.71551724137935 2017
2003 6 88.53148936170214 1685
2003 7 92.29031746031748 2145
2003 8 88.35103448275864 1974
2003 9 94.77986842105264 2510
2003 10 90.06871951219513 5731
2003 11 90.90771428571423 10862
2003 12 91.89951807228914 2961
2004 1 90.65769230769227 3245
2004 2 91.67147727272724 3117
2004 3 91.66076923076923 2332
my chart:
[Design]
I design a stacked bar chart for monthly sales volume with
secondary axis which series type is "Line Series":
category (X) series: row["ORDERYEAR"]
optional Y series grouping: row["ORDERYEAR"] + "-" + row["ORDERMONTH"]
Y axis 1: row["VOLUMN"]
Y axis 2: row["AVGPRICE"]
[Preview]
Stacked bar chart for monthly sales volume is OK.
But line chart also draw average price monthly.
How could I let line chart draw annual average price?
(i.e. disable optional Y series grouping for Y axis 2 )
Thanks,
Find more posts tagged with
Comments
bhanley
I think the main issue here is that you have valid values in the data set for each of the grouped points. In other words you do not have an annual average in your data set, you have a monthly average which maps into the grouped strategy you are applying to the volume data. I think the chart is doing exactly what it should do in this case.
I built a sample out that has the two series rendered on their own chart and then in combined form (as you want it to). I think you will see what i am talking about when you look at the stand-alone line chart. It is rendering exactly what is configured.
I think we will have to look at modifying the data set somehow to achieve what you are looking for. If you notice on the line chart in my test report, there is no Y-series grouping and asa result there is a ton of points mapped (one per month). You will need to calculate an annual sales number for the Yer before you take the data to the chart engine. The chart engine will render the data well, but it is not designed to manipulate the data before plotting it.
This did not get things working for you I understand, but I hope it helps get things straight in terms of why things are behaving like they are.
elvis_tu
Brian, thanks for your reply.<br />
<br />
I understand the behavior of the chart engine for these 3 charts.<br />
<br />
In Multi-Series Chart, could I let Y-Axis Series 1 (AVGPRICE) grouping by Category (X) Series (ORDERYEAR) but not grouping by Optional Y Series Grouping (ORDERMONTH)?<br />
<br />
Now, I write script to add a LineSeries, Y-Axis, Query to the stacked bar chart (without secondary axis in chart editor), and the chart rendered as what I want.<br />
<br />
But I still want to know: could I design such chart in chart editor (without any script) on BIRT current version?<br />
<br />
Such as "Dual Axis Demo 1" (side-by-side bar, not stacked bar) In JFreeChart sample. (<a class='bbc_url' href='
http://www.jfree.org/jfreechart/images/DualAxisDemo1.png'>http://www.jfree.org/jfreechart/images/DualAxisDemo1.png</a>)<br
/>
<br />
Thanks a lot...
bhanley
I do not think the chart editor/wizard supports that at this time, but as you saw the scripting layer can handle it just fine.
Can you post the solution to the thread so people can see the working sample? If it would help, I can retro-fit it to use the CSV sample data I built.
Nice work on the scripting.
elvis_tu
Here is my working sample (using joint data set, not scripting).
The key points are:
1. Design a joint data set to combine order monthly volume data set with order annual average price data set
2. Design a stacked bar chart for monthly sales volume with secondary axis which series type is "Line Series"
3. Format chart: disable Stacked of Series 2
4. Set proper scale for Y-Axis-2 <- I'm not sure, now
Because the aggreated orderprice for each iterated grouping by by optional Y: ordermonth in the same category(X): orderyear are identical (e.g. the orderpirces of 2003-01, 2003-02, ... 2003-12 are 90.958), so the chart engine will draw the corresponding line series markers in the same position.
But I dont know why I have to set the proper scale to draw the line series marker as well.
If you do not set the scale, you will see 12 line series markers in one stacked bar. (why??)
Now, my problem is how to hide the legend item of the Line Series?
Thanks a lot.
Piero
Hi @ all
I have a similar problem. I'm putting a second series-Line on the y-achse (see screenshot additional_series_line.png) via script initialize (see also attachement). This will work, until there is a "optional y series grouping" (see screenshot additonal_seris_line_with_grouping.png). How can I turn off the grouping for this additional series? Is there a possibility or is there an other way to resolve my problem.
I'm using this way, because I don't know if there is a solution to put a markerLine with differend datapoints.
Thanks in advance.
Piero
Piero
nobody and idea? <a class='bbc_url' href='
http://www.birt-exchange.org/org/forum/public/style_emoticons/'>http://www.birt-exchange.org/org/forum/public/style_emoticons/</a><#EMO_DIR#>/confused.gif
<br />
<br />
Thanks<br />
Piero
kclark
You could set the legend visible = false and the create an external legend.