Toggle menu
862
3.8K
30.2K
279.1K
Catglobe Wiki
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

CreateFixedCrossDiagram: Difference between revisions

From Catglobe Wiki
Hovietluu (talk | contribs)
No edit summary
No edit summary
 
(2 intermediate revisions by one other user not shown)
Line 19: Line 19:
'''Examples'''
'''Examples'''


{| border="1" cellspacing="0" cellpadding="0" style="width: 1000px"
<source lang="javascript">
|-
DCS_use(15517112);
| <div>DCS_use(15517112);</div><div>&nbsp;</div><div>// Get Axis:</div><div>array axisPrimary = Axis_new("LuuTest1");</div><div>axisPrimary[AXIS_TEXT] = "Choose a D_Week";</div><div>&nbsp;</div><div>array axisSecond = Axis_new("LuuTest2");</div><div>axisSecond[AXIS_TEXT] = "Choose a Region";</div><div>&nbsp;</div><div>Axis_addOption(axisPrimary, AxisOption_new("Year 2014", ""));</div><div>Axis_addOption(axisPrimary, AxisOption_new("Other Year", ""));</div><div>&nbsp;</div><div>Axis_addOption(axisSecond, AxisOption_new("Male", ""));</div><div>Axis_addOption(axisSecond, AxisOption_new("Female", ""));</div><div>// Init:</div><div>array arrRowseries ={};</div><div>number countTotal = count() where true;</div><div>number count;</div><div>FixedCrossTableRowSeries rowseries;</div><div>FixedCrossTableDataItem dataItemAbs;</div><div>FixedCrossTableDataItem dataItemPct;</div><div>FixedCrossTableDataSeries dataserie;</div><div>&nbsp;</div><div>dataserie = new FixedCrossTableDataSeries();</div><div>count = count() where D_Week == [201401-201453] && Gender == [1];</div><div>dataItemAbs = new FixedCrossTableDataItem();</div><div>dataItemAbs.Value = count;</div><div>dataItemPct = new FixedCrossTableDataItem();</div><div>dataItemPct.Value = count*100/countTotal;</div><div>dataserie.Add(dataItemAbs,dataItemPct);</div><div>&nbsp;</div><div>count = count() where D_Week == [201401-201453] && Gender == [2];</div><div>dataItemAbs = new FixedCrossTableDataItem();</div><div>dataItemAbs.Value = count;</div><div>dataItemPct = new FixedCrossTableDataItem();</div><div>dataItemPct.Value = count*100/countTotal;</div><div>dataserie.Add(dataItemAbs,dataItemPct);</div><div>&nbsp;</div><div>count = count() where D_Week == [201401-201453];</div><div>dataserie.AbsoluteTotal.Value = count;</div><div>dataserie.PercentageTotal.Value = count/count * 100;</div><div>rowseries.Add(dataserie);</div><div>arrRowseries = {rowseries,rowseries,rowseries};</div><div>// Set up a table</div><div>// table 2x0</div><div>&nbsp;</div><div>&nbsp;</div><div>FixedCrossTable table1x1 = new FixedCrossTable("Create by createFixedCrossDiagram ", axisPrimary,"Col title", axisSecond, arrRowseries, empty);</div><div>// genarate table:</div><div>createFixedCrossDiagram(table1x1);</div>
 
|}
// 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);
</source> Result:<br/>[[File:Table2x2.png]]


'''Availability'''
'''Availability'''
Line 28: Line 71:
Version 6.0&nbsp;__NOTOC__
Version 6.0&nbsp;__NOTOC__
<!-- imported from file: 4223.htm-->
<!-- imported from file: 4223.htm-->
[[Category:Diagram/report_generating_CGScript_functions]]

Latest revision as of 05:17, 22 April 2022


createFixedCrossDiagram

Creates a custom cross diagram.

Syntax

createFixedCrossDiagram(FixedCrossTable)

Arguments

FixedCrossTable: An FixedCrossTable expression.

Return type

number

Examples

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);

Result:

Availability

Version 6.0