FixedCrossTable class

From Catglobe Wiki
Revision as of 08:16, 7 December 2015 by Hovietluu (talk | contribs)
Jump to: navigation, search

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" />