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 beggin
fporcher
Hi,<br />
My resultset get data since 2 Years<br />
First Row an <span class='bbc_underline'>distinct</span> <strong class='bbc'>Id</strong> (string), Second a <strong class='bbc'>float</strong> Value, Thrid A <strong class='bbc'>date</strong><br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
ID-1004 6.666666805744171 2008-02-18 00:00:00
ID-1005 9.594998836517334 2008-02-18 00:00:00
ID-1007 32.400001525878906 2008-02-18 00:00:00
ID-1008 44.91666316986084 2008-02-14 00:00:00
...
</pre>
I want "draw" a chart :<br />
Y serie : 1 year group by month<br />
X serie 1 : bar - the means of float value meanning to the month and number of Id<br />
X serie 2 : area - the moving average based on 12 previous month<br />
X serie 3 : External Value (Goal to reach)<br />
<br />
A prototype is joined ...<br />
<br />
So, how to start<br />
<br />
F.P.
Find more posts tagged with
Comments
mwilliams
Hi F.P.,
You can do multiple series types on a single chart. See the following screenshot. Let me know if you have any other questions.
fporcher
<blockquote class='ipsBlockquote' data-author="mwilliams"><p>Hi F.P.,<br />
<br />
You can do multiple series types on a single chart. See the following screenshot. Let me know if you have any other questions.</p></blockquote>
<br />
Hi,<br />
Thanks, but my problem concern more how to manipulate/aggregate Data.<br />
I create a datacube <br />
* group by year/month/day<br />
* a summary fields<br />
** count(id)<br />
** sum(value)<br />
<br />
I create a bar chart (to start)<br />
In X series data["byDay/year"] + "/" + data["byDay/month"]<br />
In Y series how to make a expression like<br />
data["cube/sum_value"] / (data["cube/count_id"] * <strong class='bbc'>max day in month</strong>); <br />
I try an expression <br />
<blockquote class='ipsBlockquote' ><p>
importPackage(Packages.java.text);<br />
importPackage(Packages.java.util.Calendar);<br />
sdf = new SimpleDateFormat("yyyy/MM");<br />
current = data["byDay/year"] + "/" + data["byDay/month"];<br />
datecurrent = sdf.parse(current);<br />
calendar = Calendar.getInstance();<br />
calendar.set(Calendar.DATE, datecurrent);<br />
lastDay = calendar.get(Calendar.DAY_OF_WEEK);<br />
data["cube/sum_value"] / (data["cube/count_id"] * lastDay)<br /></p></blockquote>
but Birt doesn't found an expression
fporcher
I reply to myself,<br />
I found a solution (maybe not THE solution)<br />
<br />
I create a datacube <br />
Groupe By Date (Year, Month, Day of the Year)<br />
Summray <br />
* count on ID<br />
* sum on value<br />
<br />
Next step, I create un Chart<br />
on X series<br />
<blockquote class='ipsBlockquote' ><p>
new Date( data["byDay/year"], data["byDay/month"],0) <br /></p></blockquote>
on Y serie <br />
<blockquote class='ipsBlockquote' ><p>
if( ((new Date().getMonth()+1)==data["byDay/month"])&& ((new Date().getFullYear())==data["byDay/month"]) ){<br />
data["cube/demerite_issue"]/data["cube/jira_issue"]/(new Date().getDate()); <br />
}else{<br />
data["cube/demerite_issue"]/data["cube/jira_issue"]/(new Date( data["byDay/year"], data["byDay/month"],0).getDate()); <br />
}<br /></p></blockquote>
<br />
So it works. If anyone has simplier ...<br />
Now the moving average on 1 year ...
fporcher
Why Birt don't recognise a DateTime in the expression new Date( data["byDay/year"], data["byDay/month"],0).getDate() ? (I change pattern for X series to DateTime)
mwilliams
F.P.,
I don't think you'd need the '.getDate()' on there, new Date() returns a date already. If the "data" values are numbers, this should give you a date. What are you getting? An error?
fporcher
<blockquote class='ipsBlockquote' data-author="mwilliams"><p>F.P.,<br />
<br />
I don't think you'd need the '.getDate()' on there, new Date() returns a date already. If the "data" values are numbers, this should give you a date. What are you getting? An error?</p></blockquote>
(BIRT' version 2.3.1)<br />
I used <blockquote class='ipsBlockquote' ><p>new Date( data["byDay/year"], data["byDay/month"],0)</p></blockquote>
The windows <strong class='bbc'>edit charts</strong> don't render a preview, and I have an error (
@see
screenshot.1234791963.jpg ) <blockquote class='ipsBlockquote' ><p>Unable to use a non-datetime data to render a datetime axis</p></blockquote>.<br />
On onglet <strong class='bbc'>Format Chart</strong> I use a <em class='bbc'>datetime </em> type, that is what Birt don't appreciate (
@see
screenshot.1234792112.jpg )...<br />
The report is generated (
@see
preview.jpg )....
mwilliams
F.P.,
Can you recreate this issue with the sample database and attach that report, so I can see it myself? Thanks.
fporcher
<blockquote class='ipsBlockquote' data-author="mwilliams"><p>F.P.,<br />
<br />
Can you recreate this issue with the sample database and attach that report, so I can see it myself? Thanks.</p></blockquote>
Yes , see attachment
mwilliams
F.P.,<br />
<br />
I would say that that's probably a bug. You can log the bug at <a class='bbc_url' href='
http://www.eclipse.org/birt/phoenix/reportabug.php'>BIRT
: Reporting Bugs and Requesting Enhancements</a>. Be sure to include a good description and screen shots. Please post any bug info in here for future reference.<br />
<br />
As an easy workaround, you can add a binding to the chart in the binding tab of the property editor and use your expression there in a date or date time type binding. Then, in your chart editor, you can use the expression builder to choose that new binding for the x-axis value. That should do it.
fporcher
<blockquote class='ipsBlockquote' data-author="mwilliams"><p>F.P.,<br />
<br />
I would say that that's probably a bug. You can log the bug at <a class='bbc_url' href='
http://www.eclipse.org/birt/phoenix/reportabug.php'>BIRT
: Reporting Bugs and Requesting Enhancements</a>. Be sure to include a good description and screen shots. Please post any bug info in here for future reference.<br /></p></blockquote>
It's done (<a class='bbc_url' href='
https://bugs.eclipse.org/bugs/show_bug.cgi?id=265946'>Bug
265946</a>)<br />
<blockquote class='ipsBlockquote' data-author="mwilliams"><p>
As an easy workaround, you can add a binding to the chart in the binding tab of the property editor and use your expression there in a date or date time type binding. Then, in your chart editor, you can use the expression builder to choose that new binding for the x-axis value. That should do it.</p></blockquote>
<br />
I've created a col computed in the dataset ... more easier to manage data.