Buckets dynamic- series
Hello all,
I am using Oracle 11g release 2.
I want to generate he buckets dynamically in chart.
For instance, sales figure is between 1 to 30. I want the number of buckets to be always be 5. If I need to be between 10-30 out of 1-30, I want evenly distributed in 5 intervals. That is 10,15,20,25,30.
If my series is 20-30 and number of buckets is 5 then 22,24,26,28,30.
Can it be done in single query.
Basically I am trying to identify the buckets in charts. it will always be 5 buckets, but based on the lower and upper limit the buckets has to be obtained. Please let me know how to attain this.
Thanks in advance,
jaggyam
Hi.
Here's an example using my prevous query:
WITH d AS
SELECT 1 id, 10 val FROM dual UNION
SELECT 2 id, 13 val FROM dual UNION
SELECT 3 id, 15 val FROM dual UNION
SELECT 4 id, 17 val FROM dual UNION
SELECT 5 id, 18 val FROM dual UNION
SELECT 6 id, 20 val FROM dual UNION
SELECT 7 id, 23 val FROM dual UNION
SELECT 8 id, 30 val FROM dual UNION
SELECT 9 id, 35 val FROM dual UNION
SELECT 10 id,40 val FROM dual UNION
SELECT 11 id,42 val FROM dual UNION
SELECT 12 id,43 val FROM dual UNION
SELECT 13 id,46 val FROM dual UNION
SELECT 14 id,49 val FROM dual UNION
SELECT 15 id,50 val FROM dual
aux_intervals AS
select
(SELECT MAX(val) FROM d) -
(level - 1) * FLOOR(((SELECT MAX(val) FROM d) - (SELECT MIN(val) FROM d))/(:number_buckets-1)) int
from
dual
connect by level <= :number_buckets
intervals AS
SELECT
NVL(LAG(int) OVER (ORDER BY int),0) low,
int up
FROM aux_intervals
SELECT
low,
up,
COUNT(*) cnt
FROM
d,intervals i
WHERE
d.val > low AND
d.val <= up
GROUP BY low,up
ORDER BY 1;
:number_buckets = 5
LOW UP CNT
0 10 1
10 20 5
20 30 2
30 40 2
40 50 5 Hope this helps.
Regards.
Similar Messages
-
Dynamic Series creation for Plot Chart
Hi,
I am using a plot chart which takes data from an external XML file.
Based on certain fields in the data, I create 3 different plot series.
I use a Combo box to show different plot series based on the selected value from it.
I am placing another Combo box
How can do the below task:
I need to create some dynamic series based on some node elements in the series for which the chart is currently shown.
I create another Combo box to show the above generated plot series based on the selected value from it.Hi,
I am using a plot chart which takes data from an external XML file.
Based on certain fields in the data, I create 3 different plot series.
I use a Combo box to show different plot series based on the selected value from it.
I am placing another Combo box
How can do the below task:
I need to create some dynamic series based on some node elements in the series for which the chart is currently shown.
I create another Combo box to show the above generated plot series based on the selected value from it. -
Dynamic series in flash chart & color specified for each series
Example of data:
Date Series 1 Series 2 Series 3 Series 4 Series 5 Series 6 Series 7 Series 8
A 12 22 23 22 22 10 10 10
B 10 9 55 8 8 20 20 20
C 55 2 5 88 5 15 15 15
In excel, I can get a stacked horizontal bar chart with the numbers of different series stacked and it is easy to specify the color for each series (it works with Dephi aslo).
I use a PL/SQL to generate the dynamic series for the chart. And in my application, I need to show some serires with the same color (group of series, each has a specified color). One of the solution I am trying is to input a fixed color sequence and loop it many times in the custom color theme and then insert dummy series into the SQLS. But this could be a disaster while the number of group goes up.
Anyone has better idea on this? Or is this a limiation of apex?
Thanks.As I tried, apex can support 300 series at most. Dynamic series here is not a good solution still.
-
ADF Line Graph with dynamic series - can do ?
I want to implement a drill-down from a high level line graph into a lower level line graph. The master graph may have 4 series in it, and each of these 4 series may have 6 - 8 different sub-series that need to be shown in the lower level graph (so up to 30 in all sub-series). Rather than create 4 of the lower level graphs, what I'd like to be able to do is create the lower level graph once using a VO which reads the master graph context. The definition of a graph model however in the ADF at first glance doesn't appear to cater for this. Have others done this ?
Thinking that if I could:
a) define the detail VO so that it used generic columns for the series amounts
b) was able to override the series attribute name/label used for the legend etc. by way of code (backing bean?) for each series again based on context
c) was able to optionally hide a series that was not needed (as defined by the generic detail VO) for a given master context
... then maybe I'd have a chance. But b) and c) don't look catered for.
Anyone?
Using 11.1.For the record, I gave this a go, and was able to get it working satisfactorily. There was no way as far as I could tell to set the visibility of a series. So essentially, what I've been able to do is set the series label to blank, set the line width to 1 (min, doesn't seem to honor 0), and the color to white to match the background of the chart ... for those series that are superfluous in a given chart render. It works fine except for the fact that if you've used the highlight rollover series effect, if you move the mouse over the legend area where the "hiding" series are, you get a bit of flashing on the legend entries that are displayed.
Ideally, we'd have a way of actually taking these out entirely. If there's a way to do it, I'd be interested in hearing about it.
Thanks. -
Many dynamic series in BusinessGraphics
Hi all:
I got a List form RFC. I want to show in a pie chart.
I can't sure the List size.
My idea is dynamic add attribute, and create element.
But it does't work.
my code is like this
List list = wdContext.currentZmtk_Hr_Demo_InputElement().modelObject().getOutput().getIt_Depart();
int a = list.size();
IWDNodeInfo rootNodeInfo = wdContext.getNodeInfo();
IWDNodeInfo categoryNodeInfo = rootNodeInfo.getChild("category");
for (int i = 0; i < list.size(); i++) {
categoryNodeInfo.addAttribute("seriesValue"+(i+1), "ddic:com.sap.dictionary.double");
Zmtk_Hr_01 z = (Zmtk_Hr_01) list.get(i);
String category = z.getDepart();
short number = z.getNumber();
ICategoryElement ele = wdContext.createCategoryElement();
wdContext.nodeCategory().addElement(ele);
ele.setCategorytext(category);
ele.setAttributeValue("seriesValue"+(i+1),(double) number+"");
//ele.setSeriesValue((double) number);
I know this is wrong.
Could anyone show me what to do?Hi Allen,
1. Have you executed RFC as follows:
wdContext.currentZmtk_Hr_Demo_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
Because only after execute you will get output in to your modal node.
2. I have not worked in dynamic programming much but i believe that code
categoryNodeInfo.addAttribute("seriesValue", "ddic:com.sap.dictionary.double");
must be before for loop. And for setting data into this attribute inside for loop code will be
ele.setAttributeValue("seriesValue",(double) number+"");
Regards,
Gopal -
Dynamic buckets in ageing report
Hi All,
I am working on Stock Ageing report in which I have buckets like 0-30, 31-60, 61-90, >90. But user wants dynamic bucket ranges. Like he may be interested in a bucket of difference 20 or 30 or 40 etc. How can I make buckets dynamic.
Regards:
jitendraHi,
1. Make a input enabled Formula variable in query so that user can input the values in this.
2. using the values in this variable make other variable to restict the data these variable have to be populated through Customer
exit.
DEMO CODE :
WHEN 'VARIABLE NAME'. " var name should be in capital.
IF i_step = 2. "after the popup
CLEAR :loc_var_range.
READ TABLE i_t_var_range INTO loc_var_range
WITH KEY vnam = 'VARIABLE FOR CALDAY'.
IF sy-subrc EQ 0.
date1 = loc_var_range-low.
CALL FUNCTION 'FIMA_DATE_CREATE'
EXPORTING
i_date = date1
i_months = '-1'
i_set_last_day_of_month = '' "('X' for last date of month)
IMPORTING
e_date = lv_date15.
CLEAR l_s_range.
l_s_range-sign = 'I'. " if low value than 'E'
l_s_range-opt = 'EQ'.
l_s_range-low = lv_date15+0(6).
APPEND l_s_range TO e_t_range.
CLEAR l_s_range.
ENDIF.
ENDIF -
ALternation hierachy for Period ROll DYnamic time series.
Hi
What is custom dynamic time series in period dimensions.
How it is to be build ?any insights that would help me to build in the planning application to build custom dynamic series capability.
Please guide me how can this be achieved.
ThanksThanks Mehmet that was really helpful.!!
Not sure if you can call it better, but I have developed the following alternate hierarchy at a client and it worked with no issues:
YTD(Jan): Jan (Shared Member)
YTD(Feb): YTD(Jan)+Feb (Both shared members)
YTD(Dec): YTD(Nov)+Dec
We didn't have a QTD hieararchy, but you can use the same logic.
Cheers,
Mehmet
YTD(JAN)+Feb (both are shared members) can you explain this.
SHared member is like a pointer to primary instance of member.that would be great if you can explain this what does both are share members mean?
and alos do these members needed to be set to dynamic ?
Edited by: lakshmi on Jul 20, 2011 3:38 PM
Edited by: lakshmi on Jul 20, 2011 3:39 PM
Edited by: lakshmi on Jul 20, 2011 3:40 PM
Edited by: lakshmi on Jul 20, 2011 3:40 PM -
Create aging bucket in BEx - based on date variable
Hi everyone,
I have a report for which we need to create account receivable aging bucket to classify arrears (1>29 / 30>59 / etcu2026).
Our solution overall architecture is the following :
Source System (SAP) > BW back end...Multiprovider > Super BEx Query > Universe > Webi Report
BW 7.0
BO XI 3.2 SP3.0
In this report, each bucket is defined by the difference between:
- the Net Due Date (which is the due date of payment of the invoice)
- and the Current Date (date for which the report is run u2013 can be the date of the day or a date in the past)
We can develop this either in BEx or in Webi, but to avoid potential performance issues in Webi, we take the try to develop this in BEx.
As you can easily imagine, this BEx query will be used for many reportsu2026so not only for this specific report.
What weu2019ve done so far:
1- We created a variable to prompt the user with the date he wants to run the report for
- ZTEST is an optional variable, single value, User input, based on characteristic 0CALDAY
2- We developed RKF in BEx
- Key Figure restricted by Amount
- Net Due Date restricted by the variable ZTEST using the between function and an offset (to determine the range)
=> When we save the query we are getting a warning message saying u201CVariable ZTEST for characteristic Net Due Date has been converted to a required entryu201D
Why? (you probably knowu2026) Because my RKF is using a variable with an offsetu2026which automatically turn on my variable as mandatory and no more as optional.
Consequences:
- In BEx: My variable, which is required to be optional (because we donu2019t have to have this field as mandatory for each and every report running on top of this query) is now mandatory.
- In Webi: If I use the variable (funnel in webi), my report is working fineu2026but if I donu2019t use it in the webi report, I get an error message saying u201Cvalue required for ZTESTu201D
o Funnel is configured as optional in the universe designer (so the issue is not coming from here)
=> 2 consequencesu2026same issue
Question: What can we do to keep our bucket logic running in BEx and avoid this variable to become mandatory?
Solutions (potential)
- Create a custom exit routine to work around this issue u2013 how?
- Create CKF/Custom exit to create our bucket (using ZTEST as an entry value to determine the range) and then use the created range in our RKF to restrict the amount u2013 how? Not so easyu2026
- Build the logic in Webi
- Any other suggestions?
Here we are, any advice would be really appreciated
Thank you guys
Regards
HenriHi peeps,
We finally find a solution for this problem! So I can share it with you.
The overall solution is pretty easy to understand.
1st step is to prompt with the user with a 0DATE variable. The date selected becomes a date input for the next step.
The variables is defined as a range [01/01/1900;variable_value)...in order to retrieve the right data set.
2nd step is to use this date to create our aging bucket, dates range.
To do so, we created 4 user exit variables (for each aging bucket).
3rd step is to use these ranges in RKF.
This way you get aging bucket dynamically defined by the user input pretty cool!
Regards
H -
Programitically creating column series to flex chart not showing the chart
I want to create n number of series dynamically when i run my
application.
where n can be any value it depends on the data which i
retrieve from database. below i pasted the example
( in this example i have taken n = 4 i.e., CountMax=4 if i
change the CountMax=6 then it should generate 6series dynamically
after calculating the values. ). just copy the below code and paste
it in Flex builder and run the application.
in this example i am facing problem, chart series are not
showing. i dont know the reason why its not showing, if anyone got
the solutions for the problem please let me know. my actual
requirement is to retrieve data from Salesforce account and want to
populate the arraylist then display the chart.
<?xml version="1.0"?>
<!-- Example showing using mx:LineSeries vs using AS to
create chart series programmatically -->
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
creationComplete="drawChart()" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.charts.series.ColumnSeries;
import mx.charts.series.LineSeries;
import mx.collections.ArrayCollection;
[Bindable]
public var categoryArray:ArrayCollection = new
ArrayCollection();
[Bindable]
public var sArray:ArrayCollection = new ArrayCollection();
public function drawChart():void
var histMax:int = 25;
var histMin:int = 5;
var countMax:int = 6;
var tmpArr:Array = new Array();
categoryArray.removeAll();
for(var n:int = 0; n < 10; n++)
tmpArr[n] = histMin + Math.round((2 * n) / 20 * (histMax -
histMin));
categoryArray.addItem({data:tmpArr[n]});
// Add a series to the chart with the x-values and y-values
// from the arrays and set the series type to a column chart
for(var chartSeries:int = 0; chartSeries < countMax;
chartSeries++)
var tmpseries:Array = new Array(10);
for(var i:int = 1; i < 10; i++)
tmpseries = 3 * Math.random();
var cs:ColumnSeries = new ColumnSeries();
columnchart1.series.join( = [cs];
sArray.addItem({data:tmpseries});
//columnchart1.dataProvider = sArray;
cs = new ColumnSeries();
cs.dataProvider= sArray;
cs.displayName = 'Series';
cs.yField = 'data';
columnchart1.series[chartSeries] = cs;
]]>
</mx:Script>
<mx:Panel title="Dynamic Series Adding Sample"
width="195%" height="90%" layout="absolute">
<mx:ColumnChart id="columnchart1" height="338"
width="396" showDataTips="true" type="stacked" x="10" y="0">
<mx:horizontalAxis>
<mx:CategoryAxis dataProvider="{categoryArray}"
categoryField="data"/>
</mx:horizontalAxis>
<mx:verticalAxis>
<mx:LinearAxis baseAtZero="true" maximum="3"
autoAdjust="true"/>
</mx:verticalAxis>
</mx:ColumnChart>
</mx:Panel>
</mx:Application><?xml version="1.0"?>
<!-- Example showing using mx:ColumnSeries vs using AS to
create chart series programmatically -->
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
creationComplete="drawChart()" layout="absolute">
<mx:Script>
<![CDATA[
import mx.graphics.SolidColor;
import mx.charts.HitData;
import mx.controls.Alert;
import mx.charts.series.ColumnSeries;
import mx.charts.series.LineSeries;
import mx.collections.ArrayCollection;
[Bindable]
public var categoryArray:ArrayCollection = new
ArrayCollection();
public function drawChart():void
var histMax:int = 25;
var histMin:int = 5;
var countMax:int = 3;
var tmpArr:Array = new Array();
categoryArray.removeAll();
for(var n:int = 0; n < 10; n++)
tmpArr[n] = histMin + Math.round((2 * n) / 20 * (histMax -
histMin));
categoryArray.addItem({data:tmpArr[n]});
var cs:ColumnSeries = new ColumnSeries();
columnchart1.series = [cs];
// Add a series to the chart with the x-values and y-values
// from the arrays and set the series type to a column chart
for(var chartSeries:int = 0; chartSeries < countMax;
chartSeries++)
var tmpseries:Array = new Array(10);
for(var i:int = 0; i < 10; i++)
tmpseries
= 1 * Math.random();
if(tmpseries > 0.5)
tmpseries
= 1;
else
tmpseries = 0;
var testArrCol:ArrayCollection = new ArrayCollection();
for(var j:int =0; j < 10; j++)
var m:Number = tmpArr[j];
var m1:Number = tmpseries[j];
testArrCol.addItem({mData:m.toString(),nData:m1.toString()});
cs = new ColumnSeries();
cs.dataProvider = testArrCol;
cs.displayName = 'Series' + chartSeries;
cs.xField = 'mData';
cs.yField = 'nData';
columnchart1.series[chartSeries] = cs;
public function myTipFunction(hitData:HitData):String
return(ColumnSeries(hitData.element).displayName +" - "+
hitData.item.mData + "\n" + "Value : "+ hitData.item.nData);
]]>
</mx:Script>
<mx:Panel title="Dynamic Series Adding Sample" width="98%"
height="90%" layout="absolute">
<mx:ColumnChart id="columnchart1" height="338"
width="396" showDataTips="true" type="stacked" x="10" y="0"
dataTipFunction="{myTipFunction}">
<mx:horizontalAxis>
<mx:CategoryAxis dataProvider="{categoryArray}"
categoryField="data"/>
</mx:horizontalAxis>
<mx:verticalAxisRenderer>
<mx:AxisRenderer visible="false"/>
</mx:verticalAxisRenderer>
</mx:ColumnChart>
</mx:Panel>
</mx:Application> -
Programitically adding column series in flex chart is not showing the chart
<?xml version="1.0"?>
<!-- Example showing using mx:LineSeries vs using AS to
create chart series programmatically -->
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
creationComplete="drawChart()" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.charts.series.ColumnSeries;
import mx.charts.series.LineSeries;
import mx.collections.ArrayCollection;
[Bindable]
public var categoryArray:ArrayCollection = new
ArrayCollection();
[Bindable]
public var sArray:ArrayCollection = new ArrayCollection();
public function drawChart():void
var histMax:int = 25;
var histMin:int = 5;
var countMax:int = 6;
var tmpArr:Array = new Array();
categoryArray.removeAll();
for(var n:int = 0; n < 10; n++)
tmpArr[n] = histMin + Math.round((2 * n) / 20 * (histMax -
histMin));
categoryArray.addItem({data:tmpArr[n]});
// Add a series to the chart with the x-values and y-values
// from the arrays and set the series type to a column chart
for(var chartSeries:int = 0; chartSeries < countMax;
chartSeries++)
var tmpseries:Array = new Array(10);
for(var i:int = 1; i < 10; i++)
tmpseries
= 3 * Math.random();
var cs:ColumnSeries = new ColumnSeries();
columnchart1.series.join( = [cs];
sArray.addItem({data:tmpseries});
//columnchart1.dataProvider = sArray;
cs = new ColumnSeries();
cs.dataProvider= sArray;
cs.displayName = 'Series';
cs.yField = 'data';
columnchart1.series[chartSeries] = cs;
]]>
</mx:Script>
<mx:Panel title="Dynamic Series Adding Sample"
width="195%" height="90%" layout="absolute">
<mx:ColumnChart id="columnchart1" height="338"
width="396" showDataTips="true" type="stacked" x="10" y="0">
<mx:horizontalAxis>
<mx:CategoryAxis dataProvider="{categoryArray}"
categoryField="data"/>
</mx:horizontalAxis>
<mx:verticalAxis>
<mx:LinearAxis baseAtZero="true" maximum="3"
autoAdjust="true"/>
</mx:verticalAxis>
</mx:ColumnChart>
</mx:Panel>
</mx:Application><?xml version="1.0"?>
<!-- Example showing using mx:ColumnSeries vs using AS to
create chart series programmatically -->
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
creationComplete="drawChart()" layout="absolute">
<mx:Script>
<![CDATA[
import mx.graphics.SolidColor;
import mx.charts.HitData;
import mx.controls.Alert;
import mx.charts.series.ColumnSeries;
import mx.charts.series.LineSeries;
import mx.collections.ArrayCollection;
[Bindable]
public var categoryArray:ArrayCollection = new
ArrayCollection();
public function drawChart():void
var histMax:int = 25;
var histMin:int = 5;
var countMax:int = 3;
var tmpArr:Array = new Array();
categoryArray.removeAll();
for(var n:int = 0; n < 10; n++)
tmpArr[n] = histMin + Math.round((2 * n) / 20 * (histMax -
histMin));
categoryArray.addItem({data:tmpArr[n]});
var cs:ColumnSeries = new ColumnSeries();
columnchart1.series = [cs];
// Add a series to the chart with the x-values and y-values
// from the arrays and set the series type to a column chart
for(var chartSeries:int = 0; chartSeries < countMax;
chartSeries++)
var tmpseries:Array = new Array(10);
for(var i:int = 0; i < 10; i++)
tmpseries
= 1 * Math.random();
if(tmpseries > 0.5)
tmpseries
= 1;
else
tmpseries = 0;
var testArrCol:ArrayCollection = new ArrayCollection();
for(var j:int =0; j < 10; j++)
var m:Number = tmpArr[j];
var m1:Number = tmpseries[j];
testArrCol.addItem({mData:m.toString(),nData:m1.toString()});
cs = new ColumnSeries();
cs.dataProvider = testArrCol;
cs.displayName = 'Series' + chartSeries;
cs.xField = 'mData';
cs.yField = 'nData';
columnchart1.series[chartSeries] = cs;
public function myTipFunction(hitData:HitData):String
return(ColumnSeries(hitData.element).displayName +" - "+
hitData.item.mData + "\n" + "Value : "+ hitData.item.nData);
]]>
</mx:Script>
<mx:Panel title="Dynamic Series Adding Sample" width="98%"
height="90%" layout="absolute">
<mx:ColumnChart id="columnchart1" height="338"
width="396" showDataTips="true" type="stacked" x="10" y="0"
dataTipFunction="{myTipFunction}">
<mx:horizontalAxis>
<mx:CategoryAxis dataProvider="{categoryArray}"
categoryField="data"/>
</mx:horizontalAxis>
<mx:verticalAxisRenderer>
<mx:AxisRenderer visible="false"/>
</mx:verticalAxisRenderer>
</mx:ColumnChart>
</mx:Panel>
</mx:Application> -
Time Series Objects for a Planning Area
Hi all,
Can anyone let me know why do we create Time Series Objects for a Planning Area.
What is its Role & significance..
Regards,.
Vishal.S.Pandyatime series is usually a Demand planning concept(and used in SNP as well but in SNP its predominantly the order series that plays a main role)
time series is a general concept in statistics(and forecasting) wherein the value of a key figure is represented in a time bucket
Time series gives you an idea of the gradual change in the values by time and the relation of the future based on the past
planning area in APO (and other tools) tries to represent this as a 2 dimensional model with time on the columns and key figures in the rows. the value that you load into the cells that are formed by the above are based on the characterisitic values you choose from your MPOS which is linked to the way the values are stored in the planning area
The planning area stores data for each key figure in the smallest unit of time(technical storage buckets) and the lowest level of characterisitc value combination -
HI,
I'm extending my dashboard to display printer information.
From the sample data below I want to display, each printers
job total count for each quarter.
Bottom access should show Q2-07,Q3-07-Q1-08 vertical axis
should show integers.
From the table below I want to display in each quarter a
column bar for each printer showing total jobs, and another column
in same quarter showing page total for each printer
AEc2880->JOBCOUNT:AEc2880->PAGECOUNT:CreativeFirey240->JOBCOUNT:CreativeFirey240->PAGECOUN T:
I can either get the grid to show quarters but only on
printer, or printers but only one quarter.
<ColumnChart id="colChart" width="100%" height="100%"
showDataTips="true" visible="true" >
<horizontalAxis>
<CategoryAxis categoryField="Quarter" />
</horizontalAxis>
<series>
<ColumnSeries yField="JOBCOUNT" xField="Quarter" />
<ColumnSeries yField="JOBCOUNT" xField="Quarter" />
<ColumnSeries yField="JOBCOUNT" xField="Quarter" />
</series>
</ColumnChart>
+------------------+----------+-----------+---------+-------------------+
| PrinterName | JOBCOUNT | PAGECOUNT | Quarter |
printStartQuarter |
+------------------+----------+-----------+---------+-------------------+
| AEc2880 | 748 | 1034 | Q2-07 | 2007-04-01 |
| CreativeFirey240 | 2404 | 5454 | Q2-07 | 2007-04-01 |
| AEc2880 | 2248 | 6552 | Q3-07 | 2007-07-01 |
| AEiR5055 | 979 | 2845 | Q3-07 | 2007-07-01 |
| CreativeFirey240 | 5017 | 12321 | Q3-07 | 2007-07-01 |
| AEc2880 | 1439 | 6256 | Q4-07 | 2007-10-01 |
| AEiR5055 | 1753 | 5587 | Q4-07 | 2007-10-01 |
| CreativeFirey240 | 4731 | 9990 | Q4-07 | 2007-10-01 |
| AEc2880 | 1817 | 2707 | Q1-08 | 2008-01-01 |
| AEiR5055 | 1158 | 2817 | Q1-08 | 2008-01-01 |
| CreativeFirey240 | 3822 | 9665 | Q1-08 | 2008-01-01 |
+------------------+----------+-----------+---------+-------------------+
Thanks in advance
DeanSorry this losses formating:
I'm posting this hoping that it will point others in a
direction right or wrong. Also hoping to get some feed back on
improvements or even 'dude what where you smoking this code is
awful'.
Test Data I'm playing with from mysql.:
+------------------+----------+-----------+---------+-------------------+
| PrinterName | JOBCOUNT | PAGECOUNT | Quarter |
printStartQuarter |
+------------------+----------+-----------+---------+-------------------+
| AEc2880 | 748 | 1034 | Q2-07 | 2007-04-01 |
| CreativeFirey240 | 2404 | 5454 | Q2-07 | 2007-04-01 |
| AEc2880 | 2248 | 6552 | Q3-07 | 2007-07-01 |
| AEiR5055 | 979 | 2845 | Q3-07 | 2007-07-01 |
| CreativeFirey240 | 5017 | 12321 | Q3-07 | 2007-07-01 |
| AEc2880 | 1439 | 6256 | Q4-07 | 2007-10-01 |
| AEiR5055 | 1753 | 5587 | Q4-07 | 2007-10-01 |
| CreativeFirey240 | 4731 | 9990 | Q4-07 | 2007-10-01 |
| AEc2880 | 1817 | 2707 | Q1-08 | 2008-01-01 |
| AEiR5055 | 1158 | 2817 | Q1-08 | 2008-01-01 |
| CreativeFirey240 | 3822 | 9665 | Q1-08 | 2008-01-01 |
+------------------+----------+-----------+---------+-------------------+
Each row is a printerName, JobCount, PageCount,Quarter,
printStartQuarter (first day of each quarter)
Requirements:
I need to display summaries in a column chart of Queue
(printer) usage. For each Queue summary I need to show total jobs
sent (printed) and total pages sent (printed) for a given period.
The one I'm dealing with here is quarterly view. With the
sample data above I want to show for each quarter total job, total
pages for AEc2880,CreativeFirey240 and AEIR5055
If I use the data has is, I only get one queue per quarter. I
need to have each queue its own column, twice. One for total jobs
and total pages. Then one row per quarter for it to work.
AEc2880_TJ - AEc2880_TP - CreativeFirey240_TJ -
CreativeFirey240_TP - AEIR5055_TJ - AEIR5055_TJ - Quater -
printStartQuarter.
Now for the big issue, the queues are dynamic. The test data
is from 3 queues only. There could be 1 to n number of queues and
not all quarters will be the same as queues get added and deleted.
This is how I approached this in AS Flex 2, I have flex 3 but
not installed yet, I can not find much info on the new grouping
classes to see if they will help.
Most examples are with the advanced data grid. There is also
very little information on charting bar the basics around.
My data comes in from PHP middle ware as JSON.
First think we need to do is pass the de-serialized array
into a function that finds all the unique queue names.
[Bindable]
private var groupQueueEvent:ArrayCollection;
private function setUpHandler(event:ResultEvent):void{
//get the raw JSON data and cast to String
var rawData:String = String(event.result);
//decode the data to ActionScript using the JSON API
//in this case, the JSON data is a serialize Array of
Objects.
var arr:Array = (JSON.decode(rawData) as Array);
//Send array for processing.
groupPrinters(arr);
//function that takes quartly events and finds unique queues
private function
populateComboYearArray(eventsArray:Array):Array {
var queueArrayHashMap : Object = new Object(); //create hass
array, used to make sure array unique
var queueArray : Array = new Array; //create arry to hold
queues
//now run through each row of passed data looking for queue
names
for (var i:int = 0; i < eventsArray.length; i++)
//check to see if this
queue is all ready in hash.
if (queueArrayHashMap[eventsArray .PrinterName] ==
undefined){
//it not in hash so add it
queueArrayHashMap[eventsArray
.PrinterName] = new Object();
// now add the queue array
queueArray.push(eventsArray .PrinterName);
return queueArray; //send back final array
private function groupPrinters(data:Array):void {
//create array to hold unique names
var printerNames:Array = new Array();
//process data and get unique queue names back
printerNames = populateComboYearArray(data);
var printGroup:Array = new Array;//hold the final array
var tempRowArray:Object;//used to build each row of new data
var pgCountColumnName:String;//used to build queue names for
page count
var jobCountColumnName:String;/used to build queue names for
job count
for (var printRow:int = 0; printRow < data.length; ) {
//run through each row of data
tempRowArray = new Array; //create a new row each time
// we will always want the Quarter and printStartQaurter in
every row so add now
tempRowArray.Quarter = data[printRow].Quarter;
tempRowArray.printStartQuarter =
data[printRow].printStartQuarter;
// now for the tricky bit, we need to process each queue
name
for (var i:int = 0; i < printerNames.length; i++) {
// we need to see if we have a queue name match not all
quarters will
// have the same queue names
if (printerNames
.PrinterName == data[printRow].PrinterName) {
//if match found add to our row
//make dynamic column name would like to use queue name but
may be tainted
pgCountColumnName = "column" + String(i) + "pgcount";
jobCountColumnName = "column" + String(i) + "jbcount";
now create the columns with the names and add the data to
them
tempRowArray[pgCountColumnName] = data[printRow].PAGECOUNT;
tempRowArray[jobCountColumnName] = data[printRow].JOBCOUNT;
// we found a match so move along in outer loop
printRow++;
// we didn't find a match don't advance outer loop
// we checked all the queue names advanced outer loop where
needed,
// next time trough we should be in new quarter
printGroup.push(tempRowArray);// push temporary row to our
array
//assign are data to an array collection
groupQueueEvent = new ArrayCollection(printGroup);
//assign data to test grid for checking
detailedPrintReport.dataProvider = groupQueueEvent;
//assign data to chart.
colChart.dataProvider = groupQueueEvent;
//now make up the dynamic series
//PLEASE NOTE this code does not work yet still playing with
it
// testing purpose hard coded in mxml
var dynamicColumnSeries:ColumnSeries = new ColumnSeries;
colChart.series = [dynamicColumnSeries];
for ( i = 0; i < printerNames.length; i++) {
pgCountColumnName = "column" + String(i) + "pgcount";
jobCountColumnName = "column" + String(i) + "jbcount";
dynamicColumnSeries = new ColumnSeries;
dynamicColumnSeries.yField = 'jobCountColumnName;
dynamicColumnSeries.xField="Quarter";
dynamicColumnSeries.displayName =
printerNames.PrinterName;
colChart.series.push(dynamicColumnSeries);
dynamicColumnSeries = new ColumnSeries;
dynamicColumnSeries.yField = pgCountColumnName;
dynamicColumnSeries.displayName = printerNames
.PrinterName;
colChart.series.push(dynamicColumnSeries);
<ColumnChart id="colChart" width="100%" height="100%"
showDataTips="true" visible="true" >
<horizontalAxis>
<CategoryAxis categoryField="Quarter" title="Quartly"
labelFunction="defineLabel"/>
</horizontalAxis>
<series>
<ColumnSeries yField="column0jbcount" xField="Quarter"
/>
<ColumnSeries yField="column0pgcount" xField="Quarter"
/>
</series>
</ColumnChart>
<DataGrid id="detailedPrintReport" visible="true"
width="100%" height="100%"/> -
Hello, i am trying to display a line chart, for some sales data.
I want a line (series) for each product, X axis should be the years in the data
(2007, 2008, 2009 there is no more data than these years)
The plan is to eventually use a "Function Returning SQL Query" to get dynamic series.
But i tried to hardcode 2 lines for 2 products first to try it out.
I used this query in SQL Workshop > SQL Commands
to view the data i want and it works correctly
Query1:
SELECT product.major_brand, timeperiod.year, SUM(sales_fact.euro_sales) AS sales
FROM sales_fact
INNER JOIN product ON sales_fact.product_id = product.product_id
INNER JOIN timeperiod ON sales_fact.timeperiod_id = timeperiod.timeperiod_id
GROUP BY product.major_brand, timeperiod.year
ORDER BY product.major_brand, timeperiod.year ASCI have tried the following query for the chart but it will show 2 flat lines
with the value 0 for each year.
Query2:
SELECT NULL
,timeperiod.year
,SUM(decode(product.major_brand, 'BELCINO', sales_fact.euro_sales, 0)) "BELCINO"
,SUM(decode(product.major_brand, 'BIORGANIC', sales_fact.euro_sales, 0)) "BIORGANIC"
FROM sales_fact
INNER JOIN product ON sales_fact.product_id = product.product_id
INNER JOIN timeperiod ON sales_fact.timeperiod_id = timeperiod.timeperiod_id
GROUP BY product.major_brand, timeperiod.yearThanks for reading,
Any help is appreciated!
Edited by: 908157 on 15-jan-2012 5:22
Edited by: 908157 on 15-jan-2012 5:22Thanks Jeff for the quick response,
I have looked at the examples, tried some things
and found out that my GROUP BY was the problem.
Apperantly i only have to GROUP BY on year and not also on product.
I dont fully understand why yet,
i guess the query gets parsed and translated to 2 queries, one for each line, that makes sense
This is the query that worked for me:
SELECT NULL
,t.year
,SUM(decode(p.major_brand, 'BELCINO', s.euro_sales, 0)) "BELCINO"
,SUM(decode(p.major_brand, 'BIORGANIC', s.euro_sales, 0)) "BIORGANIC"
FROM sales_fact s, product p, timeperiod t
WHERE s.product_id = p.product_id
AND s.timeperiod_id = t.timeperiod_id
GROUP BY t.year
ORDER BY t.yearThanks again! -
DYNAMIC CREATION OF LINE SERIES USING ACTIONSCRIPT
There's something wierd about flex or im doing something
wrong?
- when i create a line series manually using mxml and specify
a id for the series, it works.
- similarly when i try to dynamically create a line series
using actionscript & define an "id" property, flex does not
understand! what am i doing wrong?
code for reference:
private function addSeries(series:Array,
yField:String,id:String) // addseries(series,"date","1000")
var ls:LineSeries= new LineSeries();
var stroke:Stroke = new Stroke()
ls.yField = yField;
ls.xField="ts"
ls.dataProvider=dp
ls.id=id // tried defining it dynamically, but flex does not
find
this.mychart.series.push(ls)
THIS IS THE ERROR I GET : "TypeError: Error #1010: A term is
undefined and has no properties."I see... I played around with the line chart ...
Hopefully this helps... if not forgive me...
I know why you are trying to use the id property which i
agree doesn't work.
since the series is an array in your lineChart use the index
to set the visible property false/true.
lineChart.series[0].visible = true/false;
<mx:Lineseries id="a1" visible="true"
dataProvider="{whatever}" />
<mx:Lineseries id="a2" visible="false"
dataProvider="{whatever}"/>
create a function called init();
public function init():void
var lineS1:LineSeries = new LineSeries();
lineS1.visible = true/false;
lineChart.series.push(lineS1);
var lineS2:LineSeries = new LineSeries();
lineS2.visible = true/false;
lineChart.series.push(lineS2);
... and the key is to call this init function on initialize
event...NOT on createComplete event
<mx:LineChart.... initialize="init()" .... />
and to show both lines... call this function...
public function showLines():void
lineChart.series[0].visible = true;
lineChart.series[1].visible = true;
Hope this helps.... -
How to set Dynamic Time Series in Planning application
Dear All,
I am having an issue by setting up dynamic time series (Y-T-D). I have set up at generation level 4. In our application the hierarchy of dimension Period is as follows.
Yeartotal -> HY1 -> Q1 -> Jan, Feb, Mar
Consider the following example
Jan -> 100
Feb -> 200
Mar -> 300
If I want to retrieve "Y-T-D Feb" the result should show me the sum of Jan & Feb in this case it should be 300. What is the syntax of retrieving YTD in smartview.
In our application "Year" dimension name is "Year". How can I rename this dimension name if this is the requirement.
Thanks in advance.
Regards,
SamiThe format in Smart View would be Y-T-D(feb) more info at http://docs.oracle.com/cd/E17236_01/epm.1112/sv_user_11121102/ch17s02s02.html
you will need to rename Year to something like Years, it depends if it is a classic or EPMA to how you rename it.
Cheers
John
http://john-goodwin.blogspot.com/
Maybe you are looking for
-
Hi All: I've been having a recurring problem ever since I've had my board: Whether I run at stock speed or oc, my sound turns off intermittently. To turn it back on I have to go into the C-Media application and switch to analog sound and then back to
-
How can I eliminate the slide when I push the home button?
How can I eliminate the slide when I push the home button?
-
Fresh Firefox install, Adobe Flash keeps crashing.
My Firefox browser keeps having problems with the Adobe Flash plugin as it keeps crashing. It is a clean FF install with only a few plugins like my password manager and ABP, i have not changed any settings, it did this from the start so there is noth
-
Can I change or create a site icon for a pinned tab?
I want to change the site icon to one on my pinned tabs. Like a cross for my church's website.
-
WMP54G+PowerMac G4+Leopard
Okay, I saw a top like this, but it did not say whether or not it supported Leopard. I am considering buying a G4 PowerMac. I have a WMP54G network card, and I was wondering if that would work with the PowerMac if I installed Leopard on it. The topic