Difference between revisions of "FixedCrossTable class"

From Catglobe Wiki
Jump to: navigation, search
Line 1: Line 1:
{{CGscriptClass_Template
+
<p><span class="fck_mw_template">{{CGscriptClass_TemplatefckLR|Name=<nowiki>FixedCrossTable</nowiki>fckLR|Description=<nowiki>A resource journal entry</nowiki>fckLR|Constructors=fckLR{{CGscriptConstructors_Template|Parameters=fckLR{{CGscriptParameters_Template|Type=string|Name=<nowiki>rowTitle</nowiki>|Description=<nowiki>Title of row.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>primaryRowAxis</nowiki>|Description=<nowiki>Axis from Axis_xxx function for the primary row axis.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=FixedCrossTableRowSeries|Name=<nowiki>rowSeries</nowiki>|Description=<nowiki>Data for the table.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>statisticsValues</nowiki>|Description=<nowiki>Array of StatisticsItems.</nowiki>}}fckLR|Description=<nowiki>Create new 1x0 FixedCrossTable.</nowiki>}}fckLR{{CGscriptConstructors_Template|Parameters=fckLR{{CGscriptParameters_Template|Type=string|Name=<nowiki>rowTitle</nowiki>|Description=<nowiki>Title of row.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>primaryRowAxis</nowiki>|Description=<nowiki>Axis from Axis_xxx function for the primary row axis.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>secondaryRowAxis</nowiki>|Description=<nowiki>Axis from Axis_xxx function for the secondary row axis.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>rowSeries</nowiki>|Description=<nowiki>Data for the table.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>statisticsValues</nowiki>|Description=<nowiki>Array of StatisticsItems.</nowiki>}}fckLR|Description=<nowiki>Create new 2x0 FixedCrossTable.</nowiki>}}fckLR{{CGscriptConstructors_Template|Parameters=fckLR{{CGscriptParameters_Template|Type=string|Name=<nowiki>rowTitle</nowiki>|Description=<nowiki>Title of row.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>primaryRowAxis</nowiki>|Description=<nowiki>Axis from Axis_xxx function for the primary row axis.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>colTitle</nowiki>|Description=<nowiki>Title of column.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>primaryColAxis</nowiki>|Description=<nowiki>Axis from Axis_xxx function for the primary column axis.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>rowSeries</nowiki>|Description=<nowiki>Data for the table.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>statisticsValues</nowiki>|Description=<nowiki>Array of StatisticsItems.</nowiki>}}fckLR|Description=<nowiki>Create new 1x1 FixedCrossTable.</nowiki>}}fckLR{{CGscriptConstructors_Template|Parameters=fckLR{{CGscriptParameters_Template|Type=string|Name=<nowiki>rowTitle</nowiki>|Description=<nowiki>Title of row.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>primaryRowAxis</nowiki>|Description=<nowiki>Axis from Axis_xxx function for the primary row axis.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>colTitle</nowiki>|Description=<nowiki>Title of column.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>primaryColAxis</nowiki>|Description=<nowiki>Axis from Axis_xxx function for the primary column axis.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>secondaryColAxis</nowiki>|Description=<nowiki>Axis from Axis_xxx function for the secondary column axis.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=FixedCrossTableRowSeries|Name=<nowiki>rowSeries</nowiki>|Description=<nowiki>Data for the table.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>statisticsValues</nowiki>|Description=<nowiki>Array of StatisticsItems.</nowiki>}}fckLR|Description=<nowiki>Create new 1x2 FixedCrossTable.</nowiki>}}fckLR{{CGscriptConstructors_Template|Parameters=fckLR{{CGscriptParameters_Template|Type=string|Name=<nowiki>rowTitle</nowiki>|Description=<nowiki>Title of row.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>primaryRowAxis</nowiki>|Description=<nowiki>Axis from Axis_xxx function for the primary row axis.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>secondaryRowAxis</nowiki>|Description=<nowiki>Axis from Axis_xxx function for the secondary row axis.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>colTitle</nowiki>|Description=<nowiki>Title of column.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>primaryColAxis</nowiki>|Description=<nowiki>Axis from Axis_xxx function for the primary column axis.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>rowSeries</nowiki>|Description=<nowiki>Data for the table.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>statisticsValues</nowiki>|Description=<nowiki>Array of StatisticsItems.</nowiki>}}fckLR|Description=<nowiki>Create new 2x1 FixedCrossTable.</nowiki>}}fckLR{{CGscriptConstructors_Template|Parameters=fckLR{{CGscriptParameters_Template|Type=string|Name=<nowiki>rowTitle</nowiki>|Description=<nowiki>Title of row.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>primaryRowAxis</nowiki>|Description=<nowiki>Axis from Axis_xxx function for the primary row axis.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>secondaryRowAxis</nowiki>|Description=<nowiki>Axis from Axis_xxx function for the secondary row axis.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>colTitle</nowiki>|Description=<nowiki>Title of column.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>primaryColAxis</nowiki>|Description=<nowiki>Axis from Axis_xxx function for the primary column axis.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>secondaryColAxis</nowiki>|Description=<nowiki>Axis from Axis_xxx function for the secondary column axis.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>rowSeries</nowiki>|Description=<nowiki>Data for the table.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>statisticsValues</nowiki>|Description=<nowiki>Array of StatisticsItems.</nowiki>}}fckLR|Description=<nowiki>Create new 2x2 FixedCrossTable.</nowiki>}}fckLR|Methods=fckLR{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Description=<nowiki>The string representation of the object.</nowiki>}}fckLR|Properties=fckLR{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}fckLR{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}}fckLR}}</span>
|Name=FixedCrossTable
+
</p>
|Description=A resource journal entry
+
<h3> Examples For Table 1x0</h3>
|Constructors=
+
<p><span class="fck_mw_source" _fck_mw_customtag="true" _fck_mw_tagname="source" lang="javascript">fckLRDCS_use(12344983);fckLRfckLR// Get Axis:fckLRarray axisNew = Axis_new(&quot;LuuTest&quot;);fckLRaxisNew[AXIS_TEXT] = &quot;Choose a D_Week&quot;;fckLRfckLR// Init:fckLRFixedCrossTableRowSeries rowseries;fckLRFixedCrossTableDataSeries dataserie;fckLRFixedCrossTableDataItem dataItemAbs;fckLRFixedCrossTableDataItem dataItemPct;fckLR// Set up a tablefckLR// table 1x0fckLRrowseries = new FixedCrossTableRowSeries();fckLRdataserie = new FixedCrossTableDataSeries();fckLRnumber count;fckLRnumber countTotal = count() where D_Week != empty;fckLRfckLRfor(number i = 201301; i &lt; 201305; i++)fckLR{fckLR Axis_addOption(axisNew, AxisOption_new(&quot;Week &quot; + i.ToString(), &quot;&quot;));fckLR fckLR count = count() where D_Week == i;fckLR dataItemAbs = new FixedCrossTableDataItem();fckLR dataItemAbs.Value = count;fckLR dataItemPct = new FixedCrossTableDataItem();fckLR dataItemPct.Value = count*100/countTotal;fckLR dataserie.Add(dataItemAbs,dataItemPct);fckLR}fckLR// otherfckLRAxis_addOption(axisNew, AxisOption_new(&quot;Week Other&quot;, &quot;&quot;));fckLRcount = count() where D_Week != [201301-201304] &amp;&amp; D_Week != empty;fckLRfckLRdataItemAbs = new FixedCrossTableDataItem();fckLRdataItemAbs.Value = count;fckLRdataItemPct = new FixedCrossTableDataItem();fckLRdataItemPct.Value = count*100/countTotal;fckLRdataserie.Add(dataItemAbs,dataItemPct);fckLRfckLRdataserie.AbsoluteTotal.Value = countTotal;fckLRdataserie.PercentageTotal.Value = countTotal*100/countTotal;fckLRfckLRrowseries.Add(dataserie);fckLRFixedCrossTable table1x0 = new FixedCrossTable(&quot;Create by createFixedCrossDiagram - D_Week&quot;, axisNew , rowseries, empty);fckLR// genarate table:fckLRcreateFixedCrossDiagram(table1x0);fckLR</span>
{{CGscriptConstructors_Template|Parameters=
+
Result:
{{CGscriptParameters_Template|Type=string|Name=rowTitle|Description=Title of row.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=primaryRowAxis|Description=Axis from Axis_xxx function for the primary row axis.|Comma=,}}{{CGscriptParameters_Template|Type=FixedCrossTableRowSeries|Name=rowSeries|Description=Data for the table.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=statisticsValues|Description=Array of StatisticsItems.}}
+
<br />
|Description=Create new 1x0 FixedCrossTable.}}
+
<img src="/images/a/ad/Table1x0.png" _fck_mw_filename="Table1x0.png" alt="" />
{{CGscriptConstructors_Template|Parameters=
+
</p>
{{CGscriptParameters_Template|Type=string|Name=rowTitle|Description=Title of row.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=primaryRowAxis|Description=Axis from Axis_xxx function for the primary row axis.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=secondaryRowAxis|Description=Axis from Axis_xxx function for the secondary row axis.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=rowSeries|Description=Data for the table.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=statisticsValues|Description=Array of StatisticsItems.}}
+
<h3> Examples For Table 2x1 </h3>
|Description=Create new 2x0 FixedCrossTable.}}
+
<p><span class="fck_mw_source" _fck_mw_customtag="true" _fck_mw_tagname="source" lang="javascript">fckLRfckLRDCS_use(15517112);fckLRfckLR// Get Axis:fckLRarray axisRowPrimary = Axis_new(&quot;LuuTest1&quot;);fckLRaxisRowPrimary[AXIS_TEXT] = &quot;Gender test&quot;;fckLRAxis_addOption(axisRowPrimary, AxisOption_new(&quot;Mand&quot;, &quot;&quot;));fckLRAxis_addOption(axisRowPrimary, AxisOption_new(&quot;Kvinde&quot;, &quot;&quot;));fckLRarray axisRowSecond = Axis_new(&quot;LuuTest2&quot;);fckLRaxisRowSecond[AXIS_TEXT] = &quot;Region test&quot;;fckLRAxis_addOption(axisRowSecond, AxisOption_new(&quot;Region Hovedstaden&quot;, &quot;&quot;));fckLRAxis_addOption(axisRowSecond, AxisOption_new(&quot;Other Region&quot;, &quot;&quot;));fckLRfckLRarray axisColPrimary = Axis_new(&quot;LuuTest3&quot;);fckLRaxisColPrimary[AXIS_TEXT] = &quot;Week test&quot;;fckLRAxis_addOption(axisColPrimary, AxisOption_new(&quot;Year 2014&quot;, &quot;&quot;));fckLRAxis_addOption(axisColPrimary, AxisOption_new(&quot;Year Other&quot;, &quot;&quot;));fckLRfckLRfckLRarray arrRowseries ={};fckLRnumber count;fckLRFixedCrossTableRowSeries rowseries;fckLRFixedCrossTableDataItem dataItemAbs;fckLRFixedCrossTableDataSeries dataserie;fckLRfckLRdataserie = new FixedCrossTableDataSeries();fckLRfckLRdataItemAbs = new FixedCrossTableDataItem();fckLRdataItemAbs.Value = 1;fckLRdataserie.Add(dataItemAbs,dataItemAbs);fckLRdataserie.Add(dataItemAbs,dataItemAbs);fckLRdataserie.AbsoluteTotal.Value = 1;fckLRdataserie.PercentageTotal.Value = 1;fckLRfckLRrowseries.Add(dataserie);fckLRrowseries.Add(dataserie);fckLRfckLRarrRowseries = {rowseries,rowseries,rowseries};fckLRfckLRFixedCrossTable table2x1 = new FixedCrossTable(&quot;Create by createFixedCrossDiagram &quot;, axisRowPrimary, axisRowSecond,&quot;Column title&quot;, axisColPrimary, arrRowseries, empty);fckLR// genarate table:fckLRcreateFixedCrossDiagram(table2x1);fckLRcreateCrossDiagram({&quot;Gender&quot;,&quot;Region&quot;},{&quot;D_Week&quot;});fckLR</span>
{{CGscriptConstructors_Template|Parameters=
+
Result:
{{CGscriptParameters_Template|Type=string|Name=rowTitle|Description=Title of row.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=primaryRowAxis|Description=Axis from Axis_xxx function for the primary row axis.|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=colTitle|Description=Title of column.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=primaryColAxis|Description=Axis from Axis_xxx function for the primary column axis.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=rowSeries|Description=Data for the table.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=statisticsValues|Description=Array of StatisticsItems.}}
+
<br />
|Description=Create new 1x1 FixedCrossTable.}}
+
<img src="/images/2/23/Table2x1.png" _fck_mw_filename="Table2x1.png" alt="" />
{{CGscriptConstructors_Template|Parameters=
+
</p><p><br />
{{CGscriptParameters_Template|Type=string|Name=rowTitle|Description=Title of row.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=primaryRowAxis|Description=Axis from Axis_xxx function for the primary row axis.|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=colTitle|Description=Title of column.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=primaryColAxis|Description=Axis from Axis_xxx function for the primary column axis.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=secondaryColAxis|Description=Axis from Axis_xxx function for the secondary column axis.|Comma=,}}{{CGscriptParameters_Template|Type=FixedCrossTableRowSeries|Name=rowSeries|Description=Data for the table.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=statisticsValues|Description=Array of StatisticsItems.}}
+
</p>
|Description=Create new 1x2 FixedCrossTable.}}
+
<h3> Examples For Table 2x2 </h3>
{{CGscriptConstructors_Template|Parameters=
+
<p><span class="fck_mw_source" _fck_mw_customtag="true" _fck_mw_tagname="source" lang="javascript">fckLRDCS_use(15517112);fckLRfckLR// Get Axis:fckLRarray axisRowPrimary = Axis_new(&quot;LuuTest1&quot;);fckLRaxisRowPrimary[AXIS_TEXT] = &quot;Gender test&quot;;fckLRAxis_addOption(axisRowPrimary, AxisOption_new(&quot;Mand&quot;, &quot;&quot;));fckLRAxis_addOption(axisRowPrimary, AxisOption_new(&quot;Kvinde&quot;, &quot;&quot;));fckLRarray axisRowSecond = Axis_new(&quot;LuuTest2&quot;);fckLRaxisRowSecond[AXIS_TEXT] = &quot;Region test&quot;;fckLRAxis_addOption(axisRowSecond, AxisOption_new(&quot;Region Hovedstaden&quot;, &quot;&quot;));fckLRAxis_addOption(axisRowSecond, AxisOption_new(&quot;Other Region&quot;, &quot;&quot;));fckLRfckLRarray axisColPrimary = Axis_new(&quot;LuuTest3&quot;);fckLRaxisColPrimary[AXIS_TEXT] = &quot;Week test&quot;;fckLRAxis_addOption(axisColPrimary, AxisOption_new(&quot;Year 2014&quot;, &quot;&quot;));fckLRAxis_addOption(axisColPrimary, AxisOption_new(&quot;Year Other&quot;, &quot;&quot;));fckLRfckLRarray axisColSecond = Axis_new(&quot;LuuTest4&quot;);fckLRaxisColSecond[AXIS_TEXT] = &quot;Age Group test&quot;;fckLRAxis_addOption(axisColSecond, AxisOption_new(&quot;Year 2014&quot;, &quot;&quot;));fckLRAxis_addOption(axisColSecond, AxisOption_new(&quot;Year Other&quot;, &quot;&quot;));fckLRfckLRarray arrRowseries ={};fckLRnumber count;fckLRFixedCrossTableRowSeries rowseries;fckLRFixedCrossTableDataItem dataItemAbs;fckLRFixedCrossTableDataSeries dataserie;fckLRfckLRdataserie = new FixedCrossTableDataSeries();fckLRfckLRdataItemAbs = new FixedCrossTableDataItem();fckLRdataItemAbs.Value = 1;fckLRdataserie.Add(dataItemAbs,dataItemAbs);fckLRdataserie.Add(dataItemAbs,dataItemAbs);fckLRdataserie.AbsoluteTotal.Value = 1;fckLRdataserie.PercentageTotal.Value = 1;fckLRfckLRrowseries.Add(dataserie);fckLRrowseries.Add(dataserie);fckLRfckLRarrRowseries = {rowseries,rowseries,rowseries,rowseries,rowseries,rowseries};fckLRfckLRFixedCrossTable table2x2 = new FixedCrossTable(&quot;Create by createFixedCrossDiagram &quot;, axisRowPrimary, axisRowSecond,&quot;Column title&quot;, axisColPrimary, axisColSecond, arrRowseries, empty);fckLR// genarate table:fckLRcreateFixedCrossDiagram(table2x2);fckLR</span>
{{CGscriptParameters_Template|Type=string|Name=rowTitle|Description=Title of row.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=primaryRowAxis|Description=Axis from Axis_xxx function for the primary row axis.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=secondaryRowAxis|Description=Axis from Axis_xxx function for the secondary row axis.|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=colTitle|Description=Title of column.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=primaryColAxis|Description=Axis from Axis_xxx function for the primary column axis.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=rowSeries|Description=Data for the table.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=statisticsValues|Description=Array of StatisticsItems.}}
+
Result:
|Description=Create new 2x1 FixedCrossTable.}}
+
<br />
{{CGscriptConstructors_Template|Parameters=
+
<img _fck_mw_valid="false" _fck_mw_filename="Table2x2.png" alt="" class="fck_mw_notfound" />
{{CGscriptParameters_Template|Type=string|Name=rowTitle|Description=Title of row.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=primaryRowAxis|Description=Axis from Axis_xxx function for the primary row axis.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=secondaryRowAxis|Description=Axis from Axis_xxx function for the secondary row axis.|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=colTitle|Description=Title of column.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=primaryColAxis|Description=Axis from Axis_xxx function for the primary column axis.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=secondaryColAxis|Description=Axis from Axis_xxx function for the secondary column axis.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=rowSeries|Description=Data for the table.|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=statisticsValues|Description=Array of StatisticsItems.}}
+
</p>
|Description=Create new 2x2 FixedCrossTable.}}
 
|Methods=
 
{{CGscriptMethods_Template|ReturnType=string|Name=ToString|Description=The string representation of the object.}}
 
|Properties=
 
{{CGscriptProperties_Template|ReturnType=string|Name=ObjectTypeName|HasGetter=1|Description=The name of the type of object.}}
 
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=TypeInformation|HasGetter=1|Description=Get information about this class.}}
 
}}
 
 
 
=== Examples For Table 1x0 ===
 
 
 
<source lang="javascript">
 
DCS_use(12344983);
 
 
 
// Get Axis:
 
array axisNew = Axis_new("LuuTest");
 
axisNew[AXIS_TEXT] = "Choose a D_Week";
 
 
 
// Init:
 
FixedCrossTableRowSeries rowseries;
 
FixedCrossTableDataSeries dataserie;
 
FixedCrossTableDataItem dataItemAbs;
 
FixedCrossTableDataItem dataItemPct;
 
// Set up a table
 
// table 1x0
 
rowseries = new FixedCrossTableRowSeries();
 
dataserie = new FixedCrossTableDataSeries();
 
number count;
 
number countTotal = count() where D_Week != empty;
 
 
 
for(number i = 201301; i < 201305; i++)
 
{
 
Axis_addOption(axisNew, AxisOption_new("Week " + i.ToString(), ""));
 
 
count = count() where D_Week == i;
 
dataItemAbs = new FixedCrossTableDataItem();
 
dataItemAbs.Value = count;
 
dataItemPct = new FixedCrossTableDataItem();
 
dataItemPct.Value = count*100/countTotal;
 
dataserie.Add(dataItemAbs,dataItemPct);
 
}
 
// other
 
Axis_addOption(axisNew, AxisOption_new("Week Other", ""));
 
count = count() where D_Week != [201301-201304] && D_Week != empty;
 
 
 
dataItemAbs = new FixedCrossTableDataItem();
 
dataItemAbs.Value = count;
 
dataItemPct = new FixedCrossTableDataItem();
 
dataItemPct.Value = count*100/countTotal;
 
dataserie.Add(dataItemAbs,dataItemPct);
 
 
 
dataserie.AbsoluteTotal.Value = countTotal;
 
dataserie.PercentageTotal.Value = countTotal*100/countTotal;
 
 
 
rowseries.Add(dataserie);
 
FixedCrossTable table1x0 = new FixedCrossTable("Create by createFixedCrossDiagram - D_Week", axisNew , rowseries, empty);
 
// genarate table:
 
createFixedCrossDiagram(table1x0);
 
</source> Result:<br/>[[File:Table1x0.png]]
 
 
 
=== Examples For Table 2x1 ===
 
 
 
<source lang="javascript">
 
 
 
DCS_use(15517112);
 
 
 
// Get Axis:
 
array axisRowPrimary = Axis_new("LuuTest1");
 
axisRowPrimary[AXIS_TEXT] = "Gender test";
 
Axis_addOption(axisRowPrimary, AxisOption_new("Mand", ""));
 
Axis_addOption(axisRowPrimary, AxisOption_new("Kvinde", ""));
 
array axisRowSecond = Axis_new("LuuTest2");
 
axisRowSecond[AXIS_TEXT] = "Region test";
 
Axis_addOption(axisRowSecond, AxisOption_new("Region Hovedstaden", ""));
 
Axis_addOption(axisRowSecond, AxisOption_new("Other Region", ""));
 
 
 
array axisColPrimary = Axis_new("LuuTest3");
 
axisColPrimary[AXIS_TEXT] = "Week test";
 
Axis_addOption(axisColPrimary, AxisOption_new("Year 2014", ""));
 
Axis_addOption(axisColPrimary, AxisOption_new("Year Other", ""));
 
 
 
 
 
array arrRowseries ={};
 
number count;
 
FixedCrossTableRowSeries rowseries;
 
FixedCrossTableDataItem dataItemAbs;
 
FixedCrossTableDataSeries dataserie;
 
 
 
dataserie = new FixedCrossTableDataSeries();
 
 
 
dataItemAbs = new FixedCrossTableDataItem();
 
dataItemAbs.Value = 1;
 
dataserie.Add(dataItemAbs,dataItemAbs);
 
dataserie.Add(dataItemAbs,dataItemAbs);
 
dataserie.AbsoluteTotal.Value = 1;
 
dataserie.PercentageTotal.Value = 1;
 
 
 
rowseries.Add(dataserie);
 
rowseries.Add(dataserie);
 
 
 
arrRowseries = {rowseries,rowseries,rowseries};
 
 
 
FixedCrossTable table2x1 = new FixedCrossTable("Create by createFixedCrossDiagram ", axisRowPrimary, axisRowSecond,"Column title", axisColPrimary, arrRowseries, empty);
 
// genarate table:
 
createFixedCrossDiagram(table2x1);
 
createCrossDiagram({"Gender","Region"},{"D_Week"});
 
</source> Result:<br/>[[File:Table2x1.png]]
 

Revision as of 08:16, 7 December 2015

Template:CGscriptClass TemplatefckLR

Examples For Table 1x0

fckLRDCS_use(12344983);fckLRfckLR// Get Axis:fckLRarray axisNew = Axis_new("LuuTest");fckLRaxisNew[AXIS_TEXT] = "Choose a D_Week";fckLRfckLR// Init:fckLRFixedCrossTableRowSeries rowseries;fckLRFixedCrossTableDataSeries dataserie;fckLRFixedCrossTableDataItem dataItemAbs;fckLRFixedCrossTableDataItem dataItemPct;fckLR// Set up a tablefckLR// table 1x0fckLRrowseries = new FixedCrossTableRowSeries();fckLRdataserie = new FixedCrossTableDataSeries();fckLRnumber count;fckLRnumber countTotal = count() where D_Week != empty;fckLRfckLRfor(number i = 201301; i < 201305; i++)fckLR{fckLR Axis_addOption(axisNew, AxisOption_new("Week " + i.ToString(), ""));fckLR fckLR count = count() where D_Week == i;fckLR dataItemAbs = new FixedCrossTableDataItem();fckLR dataItemAbs.Value = count;fckLR dataItemPct = new FixedCrossTableDataItem();fckLR dataItemPct.Value = count*100/countTotal;fckLR dataserie.Add(dataItemAbs,dataItemPct);fckLR}fckLR// otherfckLRAxis_addOption(axisNew, AxisOption_new("Week Other", ""));fckLRcount = count() where D_Week != [201301-201304] && D_Week != empty;fckLRfckLRdataItemAbs = new FixedCrossTableDataItem();fckLRdataItemAbs.Value = count;fckLRdataItemPct = new FixedCrossTableDataItem();fckLRdataItemPct.Value = count*100/countTotal;fckLRdataserie.Add(dataItemAbs,dataItemPct);fckLRfckLRdataserie.AbsoluteTotal.Value = countTotal;fckLRdataserie.PercentageTotal.Value = countTotal*100/countTotal;fckLRfckLRrowseries.Add(dataserie);fckLRFixedCrossTable table1x0 = new FixedCrossTable("Create by createFixedCrossDiagram - D_Week", axisNew , rowseries, empty);fckLR// genarate table:fckLRcreateFixedCrossDiagram(table1x0);fckLR Result:
<img src="/images/a/ad/Table1x0.png" _fck_mw_filename="Table1x0.png" alt="" />

Examples For Table 2x1

fckLRfckLRDCS_use(15517112);fckLRfckLR// Get Axis:fckLRarray axisRowPrimary = Axis_new("LuuTest1");fckLRaxisRowPrimary[AXIS_TEXT] = "Gender test";fckLRAxis_addOption(axisRowPrimary, AxisOption_new("Mand", ""));fckLRAxis_addOption(axisRowPrimary, AxisOption_new("Kvinde", ""));fckLRarray axisRowSecond = Axis_new("LuuTest2");fckLRaxisRowSecond[AXIS_TEXT] = "Region test";fckLRAxis_addOption(axisRowSecond, AxisOption_new("Region Hovedstaden", ""));fckLRAxis_addOption(axisRowSecond, AxisOption_new("Other Region", ""));fckLRfckLRarray axisColPrimary = Axis_new("LuuTest3");fckLRaxisColPrimary[AXIS_TEXT] = "Week test";fckLRAxis_addOption(axisColPrimary, AxisOption_new("Year 2014", ""));fckLRAxis_addOption(axisColPrimary, AxisOption_new("Year Other", ""));fckLRfckLRfckLRarray arrRowseries ={};fckLRnumber count;fckLRFixedCrossTableRowSeries rowseries;fckLRFixedCrossTableDataItem dataItemAbs;fckLRFixedCrossTableDataSeries dataserie;fckLRfckLRdataserie = new FixedCrossTableDataSeries();fckLRfckLRdataItemAbs = new FixedCrossTableDataItem();fckLRdataItemAbs.Value = 1;fckLRdataserie.Add(dataItemAbs,dataItemAbs);fckLRdataserie.Add(dataItemAbs,dataItemAbs);fckLRdataserie.AbsoluteTotal.Value = 1;fckLRdataserie.PercentageTotal.Value = 1;fckLRfckLRrowseries.Add(dataserie);fckLRrowseries.Add(dataserie);fckLRfckLRarrRowseries = {rowseries,rowseries,rowseries};fckLRfckLRFixedCrossTable table2x1 = new FixedCrossTable("Create by createFixedCrossDiagram ", axisRowPrimary, axisRowSecond,"Column title", axisColPrimary, arrRowseries, empty);fckLR// genarate table:fckLRcreateFixedCrossDiagram(table2x1);fckLRcreateCrossDiagram({"Gender","Region"},{"D_Week"});fckLR Result:
<img src="/images/2/23/Table2x1.png" _fck_mw_filename="Table2x1.png" alt="" />


Examples For Table 2x2

fckLRDCS_use(15517112);fckLRfckLR// Get Axis:fckLRarray axisRowPrimary = Axis_new("LuuTest1");fckLRaxisRowPrimary[AXIS_TEXT] = "Gender test";fckLRAxis_addOption(axisRowPrimary, AxisOption_new("Mand", ""));fckLRAxis_addOption(axisRowPrimary, AxisOption_new("Kvinde", ""));fckLRarray axisRowSecond = Axis_new("LuuTest2");fckLRaxisRowSecond[AXIS_TEXT] = "Region test";fckLRAxis_addOption(axisRowSecond, AxisOption_new("Region Hovedstaden", ""));fckLRAxis_addOption(axisRowSecond, AxisOption_new("Other Region", ""));fckLRfckLRarray axisColPrimary = Axis_new("LuuTest3");fckLRaxisColPrimary[AXIS_TEXT] = "Week test";fckLRAxis_addOption(axisColPrimary, AxisOption_new("Year 2014", ""));fckLRAxis_addOption(axisColPrimary, AxisOption_new("Year Other", ""));fckLRfckLRarray axisColSecond = Axis_new("LuuTest4");fckLRaxisColSecond[AXIS_TEXT] = "Age Group test";fckLRAxis_addOption(axisColSecond, AxisOption_new("Year 2014", ""));fckLRAxis_addOption(axisColSecond, AxisOption_new("Year Other", ""));fckLRfckLRarray arrRowseries ={};fckLRnumber count;fckLRFixedCrossTableRowSeries rowseries;fckLRFixedCrossTableDataItem dataItemAbs;fckLRFixedCrossTableDataSeries dataserie;fckLRfckLRdataserie = new FixedCrossTableDataSeries();fckLRfckLRdataItemAbs = new FixedCrossTableDataItem();fckLRdataItemAbs.Value = 1;fckLRdataserie.Add(dataItemAbs,dataItemAbs);fckLRdataserie.Add(dataItemAbs,dataItemAbs);fckLRdataserie.AbsoluteTotal.Value = 1;fckLRdataserie.PercentageTotal.Value = 1;fckLRfckLRrowseries.Add(dataserie);fckLRrowseries.Add(dataserie);fckLRfckLRarrRowseries = {rowseries,rowseries,rowseries,rowseries,rowseries,rowseries};fckLRfckLRFixedCrossTable table2x2 = new FixedCrossTable("Create by createFixedCrossDiagram ", axisRowPrimary, axisRowSecond,"Column title", axisColPrimary, axisColSecond, arrRowseries, empty);fckLR// genarate table:fckLRcreateFixedCrossDiagram(table2x2);fckLR Result:
<img _fck_mw_valid="false" _fck_mw_filename="Table2x2.png" alt="" class="fck_mw_notfound" />