CreateFixedCrossDiagram

From Catglobe Wiki
Revision as of 03:19, 8 December 2015 by Hovietluu (talk | contribs)
Jump to: navigation, search


createFixedCrossDiagram

Creates a custom cross diagram.

Syntax

createFixedCrossDiagram(FixedCrossTable)

Arguments

FixedCrossTable: An FixedCrossTable expression.

Return type

number

Examples

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
FixedCrossTable table1x1 = new FixedCrossTable("Create by createFixedCrossDiagram ", axisPrimary,"Col title", axisSecond, arrRowseries, empty);
// genarate table:
createFixedCrossDiagram(table1x1);

Availability

Version 6.0