Difference between revisions of "FixedCrossTable class"
Line 32: | Line 32: | ||
<source lang="javascript"> | <source lang="javascript"> | ||
DCS_use(12344983); | DCS_use(12344983); | ||
− | + | ||
// Get Axis: | // Get Axis: | ||
array axisNew = Axis_new("LuuTest"); | array axisNew = Axis_new("LuuTest"); | ||
axisNew[AXIS_TEXT] = "Choose a D_Week"; | axisNew[AXIS_TEXT] = "Choose a D_Week"; | ||
− | + | ||
// Init: | // Init: | ||
FixedCrossTableRowSeries rowseries; | FixedCrossTableRowSeries rowseries; | ||
Line 48: | Line 48: | ||
number count; | number count; | ||
number countTotal = count() where D_Week != empty; | number countTotal = count() where D_Week != empty; | ||
− | + | ||
for(number i = 201301; i < 201305; i++) | for(number i = 201301; i < 201305; i++) | ||
{ | { | ||
Line 63: | Line 63: | ||
Axis_addOption(axisNew, AxisOption_new("Week Other", "")); | Axis_addOption(axisNew, AxisOption_new("Week Other", "")); | ||
count = count() where D_Week != [201301-201304] && D_Week != empty; | count = count() where D_Week != [201301-201304] && D_Week != empty; | ||
− | + | ||
dataItemAbs = new FixedCrossTableDataItem(); | dataItemAbs = new FixedCrossTableDataItem(); | ||
dataItemAbs.Value = count; | dataItemAbs.Value = count; | ||
Line 69: | Line 69: | ||
dataItemPct.Value = count*100/countTotal; | dataItemPct.Value = count*100/countTotal; | ||
dataserie.Add(dataItemAbs,dataItemPct); | dataserie.Add(dataItemAbs,dataItemPct); | ||
+ | // add statistics Values | ||
+ | dataserie.AddStat(dataItemAbs); | ||
+ | dataserie.AddStat(dataItemAbs); | ||
dataserie.AbsoluteTotal.Value = countTotal; | dataserie.AbsoluteTotal.Value = countTotal; | ||
dataserie.PercentageTotal.Value = countTotal*100/countTotal; | dataserie.PercentageTotal.Value = countTotal*100/countTotal; | ||
− | + | ||
rowseries.Add(dataserie); | rowseries.Add(dataserie); | ||
− | FixedCrossTable table1x0 = new FixedCrossTable("Create by createFixedCrossDiagram - D_Week", axisNew , rowseries, | + | FixedCrossTable table1x0 = new FixedCrossTable("Create by createFixedCrossDiagram - D_Week", axisNew , rowseries, {}); |
+ | setMedian(true); | ||
+ | addPercentile(20); | ||
// genarate table: | // genarate table: | ||
createFixedCrossDiagram(table1x0); | createFixedCrossDiagram(table1x0); |
Revision as of 08:50, 15 April 2016
FixedCrossTable
A resource journal entry
Constructors
- (string rowTitle "Title of row.", array primaryRowAxis "Axis from Axis_xxx function for the primary row axis.", FixedCrossTableRowSeries rowSeries "Data for the table.", array statisticsValues "Array of StatisticsItems.") - Create new 1x0 FixedCrossTable.
- (string rowTitle "Title of row.", array primaryRowAxis "Axis from Axis_xxx function for the primary row axis.", array secondaryRowAxis "Axis from Axis_xxx function for the secondary row axis.", array rowSeries "Data for the table.", array statisticsValues "Array of StatisticsItems.") - Create new 2x0 FixedCrossTable.
- (string rowTitle "Title of row.", array primaryRowAxis "Axis from Axis_xxx function for the primary row axis.", string colTitle "Title of column.", array primaryColAxis "Axis from Axis_xxx function for the primary column axis.", array rowSeries "Data for the table.", array statisticsValues "Array of StatisticsItems.") - Create new 1x1 FixedCrossTable.
- (string rowTitle "Title of row.", array primaryRowAxis "Axis from Axis_xxx function for the primary row axis.", string colTitle "Title of column.", array primaryColAxis "Axis from Axis_xxx function for the primary column axis.", array secondaryColAxis "Axis from Axis_xxx function for the secondary column axis.", FixedCrossTableRowSeries rowSeries "Data for the table.", array statisticsValues "Array of StatisticsItems.") - Create new 1x2 FixedCrossTable.
- (string rowTitle "Title of row.", array primaryRowAxis "Axis from Axis_xxx function for the primary row axis.", array secondaryRowAxis "Axis from Axis_xxx function for the secondary row axis.", string colTitle "Title of column.", array primaryColAxis "Axis from Axis_xxx function for the primary column axis.", array rowSeries "Data for the table.", array statisticsValues "Array of StatisticsItems.") - Create new 2x1 FixedCrossTable.
- (string rowTitle "Title of row.", array primaryRowAxis "Axis from Axis_xxx function for the primary row axis.", array secondaryRowAxis "Axis from Axis_xxx function for the secondary row axis.", string colTitle "Title of column.", array primaryColAxis "Axis from Axis_xxx function for the primary column axis.", array secondaryColAxis "Axis from Axis_xxx function for the secondary column axis.", array rowSeries "Data for the table.", array statisticsValues "Array of StatisticsItems.") - Create new 2x2 FixedCrossTable.
Methods
- string ToString() - The string representation of the object.
Properties
- string ObjectTypeName { get; } - The name of the type of object.
- TypeInformation TypeInformation { get; } - Get information about this class.
Examples For Table 1x0
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);
// add statistics Values
dataserie.AddStat(dataItemAbs);
dataserie.AddStat(dataItemAbs);
dataserie.AbsoluteTotal.Value = countTotal;
dataserie.PercentageTotal.Value = countTotal*100/countTotal;
rowseries.Add(dataserie);
FixedCrossTable table1x0 = new FixedCrossTable("Create by createFixedCrossDiagram - D_Week", axisNew , rowseries, {});
setMedian(true);
addPercentile(20);
// genarate table:
createFixedCrossDiagram(table1x0);
Examples For Table 1x1
DCS_use(15517112);
// Get Axis:
array axisPrimary = Axis_new("LuuTest1");
axisPrimary[AXIS_TEXT] = "Choose a D_Week";
array axisSecond = Axis_new("LuuTest2");
axisSecond[AXIS_TEXT] = "Choose a Region";
Axis_addOption(axisPrimary, AxisOption_new("Year 2014", ""));
Axis_addOption(axisPrimary, AxisOption_new("Other Year", ""));
Axis_addOption(axisSecond, AxisOption_new("Male", ""));
Axis_addOption(axisSecond, AxisOption_new("Female", ""));
// Init:
array arrRowseries ={};
number countTotal = count() where true;
number count;
FixedCrossTableRowSeries rowseries;
FixedCrossTableDataItem dataItemAbs;
FixedCrossTableDataItem dataItemPct;
FixedCrossTableDataSeries dataserie;
dataserie = new FixedCrossTableDataSeries();
count = count() where D_Week == [201401-201453] && Gender == [1];
dataItemAbs = new FixedCrossTableDataItem();
dataItemAbs.Value = count;
dataItemPct = new FixedCrossTableDataItem();
dataItemPct.Value = count*100/countTotal;
dataserie.Add(dataItemAbs,dataItemPct);
count = count() where D_Week == [201401-201453] && Gender == [2];
dataItemAbs = new FixedCrossTableDataItem();
dataItemAbs.Value = count;
dataItemPct = new FixedCrossTableDataItem();
dataItemPct.Value = count*100/countTotal;
dataserie.Add(dataItemAbs,dataItemPct);
count = count() where D_Week == [201401-201453];
dataserie.AbsoluteTotal.Value = count;
dataserie.PercentageTotal.Value = count/count * 100;
rowseries.Add(dataserie);
arrRowseries = {rowseries,rowseries,rowseries};
// Set up a table
// table 2x0
FixedCrossTable table1x1 = new FixedCrossTable("Create by createFixedCrossDiagram ", axisPrimary,"Col title", axisSecond, arrRowseries, empty);
// genarate table:
createFixedCrossDiagram(table1x1);
Examples For Table 2x1
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"});
Examples For Table 2x2
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 axisColSecond = Axis_new("LuuTest4");
axisColSecond[AXIS_TEXT] = "Age Group test";
Axis_addOption(axisColSecond, AxisOption_new("Year 2014", ""));
Axis_addOption(axisColSecond, 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,rowseries,rowseries,rowseries};
FixedCrossTable table2x2 = new FixedCrossTable("Create by createFixedCrossDiagram ", axisRowPrimary, axisRowSecond,"Column title", axisColPrimary, axisColSecond, arrRowseries, empty);
// genarate table:
createFixedCrossDiagram(table2x2);