Difference between revisions of "CreateFixedCrossDiagram"
Line 21: | Line 21: | ||
{| border="1" cellspacing="0" cellpadding="0" style="width: 1000px" | {| border="1" cellspacing="0" cellpadding="0" style="width: 1000px" | ||
|- | |- | ||
− | | <div>DCS_use(15517112);</div><div> </div><div>// Get Axis:</div><div>array axisPrimary = Axis_new("LuuTest1");</div><div>axisPrimary[AXIS_TEXT] = "Choose a D_Week";</div><div> </div><div>array axisSecond = Axis_new("LuuTest2");</div><div>axisSecond[AXIS_TEXT] = "Choose a Region";</div><div> </div><div>Axis_addOption(axisPrimary, AxisOption_new("Year 2014", ""));</div><div>Axis_addOption(axisPrimary, AxisOption_new("Other Year", ""));</div><div> </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> </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> </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> </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>DCS_use(15517112);</div><div> </div><div>// Get Axis:</div><div>array axisPrimary = Axis_new("LuuTest1");</div><div>axisPrimary[AXIS_TEXT] = "Choose a D_Week";</div><div> </div><div>array axisSecond = Axis_new("LuuTest2");</div><div>axisSecond[AXIS_TEXT] = "Choose a Region";</div><div> </div><div>Axis_addOption(axisPrimary, AxisOption_new("Year 2014", ""));</div><div>Axis_addOption(axisPrimary, AxisOption_new("Other Year", ""));</div><div> </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> </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> </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> </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>FixedCrossTable table1x1 = new FixedCrossTable("Create by createFixedCrossDiagram ", axisPrimary,"Col title", axisSecond, arrRowseries, empty);</div><div>// genarate table:</div><div>createFixedCrossDiagram(table1x1);</div> |
|} | |} | ||
Revision as of 03:19, 8 December 2015
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