1. Create the transient chart with two dimensions (CategoryID and ProductID) and one measure (Sum(OrderTotal)).
The client sends:
{
"jsonrpc": "2.0",
"id": 1,
"method": "CreateSessionObject",
"handle": 1,
"params": [
{
"qInfo": {
"qId": "",
"qType": "Chart"
},
"qHyperCubeDef": {
"qStateName": "$",
"qDimensions": [
{
"qLibraryId": "",
"qNullSuppression": false,
"qDef": {
"qGrouping": "N",
"qFieldDefs": [
"CategoryID"
],
"qFieldLabels": [
"CategoryID label"
]
}
},
{
"qLibraryId": "",
"qNullSuppression": false,
"qDef": {
"qGrouping": "N",
"qFieldDefs": [
"ProductID"
],
"qFieldLabels": [
"ProductID label"
]
}
}
],
"qMeasures": [
{
"qLibraryId": "",
"qSortBy": {
"qSortByState": 0,
"qSortByFrequency": 0,
"qSortByNumeric": 0,
"qSortByAscii": 0,
"qSortByLoadOrder": 1,
"qSortByExpression": 0,
"qExpression": {
"qv": ""
}
},
"qDef": {
"qLabel": "",
"qDescription": "",
"qTags": [
"tags"
],
"qGrouping": "N",
"qDef": "Sum(OrderTotal)"
}
}
],
"qInitialDataFetch": [
{
"qTop": 0,
"qLeft": 0,
"qHeight": 5,
"qWidth": 20
},
{
"qTop": 0,
"qLeft": 0,
"qHeight": 0,
"qWidth": 0
},
{
"qTop": 0,
"qLeft": 0,
"qHeight": 0,
"qWidth": 0
}
]
}
}
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"qReturn": {
"qType": "GenericObject",
"qHandle": 2
}
},
"change": [
2
]
}
The chart is created and the handle is 2.
2. Get the layout of the chart.
The client sends:
{
"jsonrpc": "2.0",
"id": 2,
"method": "GetLayout",
"handle": 2,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"qLayout": {
"qInfo": {
"qId": "CH01",
"qType": "Chart"
},
"qMeta": {},
"qSelectionInfo": {},
"qHyperCube": {
"qStateName": "$",
"qSize": {
"qcx": 3,
"qcy": 10
},
"qDimensionInfo": [
{
"qFallbackTitle": "CategoryID label",
"qApprMaxGlyphCount": 1,
"qCardinal": 5,
"qSortIndicator": "N",
"qGroupFallbackTitles": [
"CategoryID label"
],
"qGroupPos": 0,
"qStateCounts": {
"qLocked": 0,
"qSelected": 0,
"qOption": 5,
"qDeselected": 0,
"qAlternative": 0,
"qExcluded": 0
},
"qTags": [
"$key",
"$numeric",
"$integer"
],
"qDimensionType": "N",
"qGrouping": "N"
},
{
"qFallbackTitle": "ProductID label",
"qApprMaxGlyphCount": 2,
"qCardinal": 10,
"qSortIndicator": "N",
"qGroupFallbackTitles": [
"ProductID label"
],
"qGroupPos": 0,
"qStateCounts": {
"qLocked": 0,
"qSelected": 0,
"qOption": 10,
"qDeselected": 0,
"qAlternative": 0,
"qExcluded": 0
},
"qTags": [
"$key",
"$numeric",
"$integer"
],
"qDimensionType": "N",
"qGrouping": "N"
}
],
"qMeasureInfo": [
{
"qFallbackTitle": "Sum(OrderTotal)",
"qApprMaxGlyphCount": 10,
"qCardinal": 11,
"qSortIndicator": "A",
"qNumFormat": {
"qType": "U",
"qnDec": 10,
"qUseThou": 0
},
"qMin": 164.1675,
"qMax": 5841
}
],
"qEffectiveInterColumnSortOrder": [
0,
1,
2
],
"qGrandTotalRow": [
{
"qText": "19127,4425",
"qNum": 19127.442500000008,
"qElemNumber": -1,
"qState": "X",
"qIsTotalCell": true
},
{
"qText": "19127,4425",
"qNum": 19127.442500000008,
"qElemNumber": -1,
"qState": "X",
"qIsTotalCell": true
}
],
"qDataPages": [
{
"qMatrix": [
[
{
"qText": "1",
"qNum": 1,
"qElemNumber": 0,
"qState": "O"
},
{
"qText": "76",
"qNum": 76,
"qElemNumber": 2,
"qState": "O"
},
{
"qText": "1416,35",
"qNum": 1416.35,
"qElemNumber": 0,
"qState": "L"
}
],
[
{
"qText": "1",
"qNum": 1,
"qElemNumber": 0,
"qState": "O"
},
{
"qText": "39",
"qNum": 39,
"qElemNumber": 7,
"qState": "O"
},
{
"qText": "424,8",
"qNum": 424.79999999999995,
"qElemNumber": 0,
"qState": "L"
}
],
[
{
"qText": "2",
"qNum": 2,
"qElemNumber": 1,
"qState": "O"
},
{
"qText": "77",
"qNum": 77,
"qElemNumber": 0,
"qState": "O"
},
{
"qText": "2027,376",
"qNum": 2027.376,
"qElemNumber": 0,
"qState": "L"
}
],
[
{
"qText": "2",
"qNum": 2,
"qElemNumber": 1,
"qState": "O"
},
{
"qText": "6",
"qNum": 6,
"qElemNumber": 4,
"qState": "O"
},
{
"qText": "1110,96",
"qNum": 1110.96,
"qElemNumber": 0,
"qState": "L"
}
],
[
{
"qText": "2",
"qNum": 2,
"qElemNumber": 1,
"qState": "O"
},
{
"qText": "63",
"qNum": 63,
"qElemNumber": 5,
"qState": "O"
},
{
"qText": "3420,005",
"qNum": 3420.005,
"qElemNumber": 0,
"qState": "L"
}
]
],
"qTails": [
{
"qUp": 0,
"qDown": 0
},
{
"qUp": 0,
"qDown": 0
}
],
"qArea": {
"qLeft": 0,
"qTop": 0,
"qWidth": 3,
"qHeight": 5
}
},
{
"qMatrix": [],
"qTails": [],
"qArea": {
"qLeft": 0,
"qTop": 0,
"qWidth": 0,
"qHeight": 0
}
},
{
"qMatrix": [],
"qTails": [],
"qArea": {
"qLeft": 0,
"qTop": 0,
"qWidth": 0,
"qHeight": 0
}
}
],
"qPivotDataPages": [],
"qStackedDataPages": [],
"qMode": "S"
}
}
}
}
All values are in the optional state.
If the data are represented in a table, we have the following:
Example table data
CategoryID |
ProductID |
Sum([OrderTotal]) |
1 |
76 |
1416.35 |
1 |
39 |
424.8 |
2 |
77 |
2027.376 |
2 |
6 |
1110.96 |
2 |
63 |
3420.005 |
4 |
71 |
2389.5 |
4 |
59 |
726.984 |
7 |
28 |
1606.3 |
8 |
58 |
5841 |
8 |
46 |
164.1675 |
3. Select the row indexes: (0, 2 and 4) and the columns: (0 and 1). Selections are made in both dimensions.
The client sends:
{
"jsonrpc": "2.0",
"id": 3,
"method": "SelectHyperCubeCells",
"handle": 2,
"params": [
"/qHyperCubeDef",
[
0,
2,
4
],
[
0,
1
],
false
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 3,
"result": {
"qSuccess": true
},
"change": [
2
]
}
The selections are successful.
4. Get the layout of the chart.
The client sends:
{
"jsonrpc": "2.0",
"id": 4,
"method": "GetLayout",
"handle": 2,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 4,
"result": {
"qLayout": {
"qInfo": {
"qId": "CH01",
"qType": "Chart"
},
"qMeta": {},
"qSelectionInfo": {},
"qHyperCube": {
"qStateName": "$",
"qSize": {
"qcx": 3,
"qcy": 3
},
"qDimensionInfo": [
{
"qFallbackTitle": "CategoryID label",
"qApprMaxGlyphCount": 1,
"qCardinal": 5,
"qSortIndicator": "N",
"qGroupFallbackTitles": [
"CategoryID label"
],
"qGroupPos": 0,
"qStateCounts": {
"qLocked": 0,
"qSelected": 2,
"qOption": 0,
"qDeselected": 0,
"qAlternative": 0,
"qExcluded": 3
},
"qTags": [
"$key",
"$numeric",
"$integer"
],
"qDimensionType": "N",
"qGrouping": "N"
},
{
"qFallbackTitle": "ProductID label",
"qApprMaxGlyphCount": 2,
"qCardinal": 10,
"qSortIndicator": "N",
"qGroupFallbackTitles": [
"ProductID label"
],
"qGroupPos": 0,
"qStateCounts": {
"qLocked": 0,
"qSelected": 3,
"qOption": 0,
"qDeselected": 0,
"qAlternative": 2,
"qExcluded": 5
},
"qTags": [
"$key",
"$numeric",
"$integer"
],
"qDimensionType": "N",
"qGrouping": "N"
}
],
"qMeasureInfo": [
{
"qFallbackTitle": "Sum(OrderTotal)",
"qApprMaxGlyphCount": 8,
"qCardinal": 4,
"qSortIndicator": "A",
"qNumFormat": {
"qType": "U",
"qnDec": 10,
"qUseThou": 0
},
"qMin": 1416.35,
"qMax": 3420.005
}
],
"qEffectiveInterColumnSortOrder": [
0,
1,
2
],
"qGrandTotalRow": [
{
"qText": "6863,731",
"qNum": 6863.7310000000007,
"qElemNumber": -1,
"qState": "X",
"qIsTotalCell": true
},
{
"qText": "6863,731",
"qNum": 6863.7310000000007,
"qElemNumber": -1,
"qState": "X",
"qIsTotalCell": true
}
],
"qDataPages": [
{
"qMatrix": [
[
{
"qText": "1",
"qNum": 1,
"qElemNumber": 0,
"qState": "S"
},
{
"qText": "76",
"qNum": 76,
"qElemNumber": 2,
"qState": "S"
},
{
"qText": "1416,35",
"qNum": 1416.35,
"qElemNumber": 0,
"qState": "L"
}
],
[
{
"qText": "2",
"qNum": 2,
"qElemNumber": 1,
"qState": "S"
},
{
"qText": "77",
"qNum": 77,
"qElemNumber": 0,
"qState": "S"
},
{
"qText": "2027,376",
"qNum": 2027.376,
"qElemNumber": 0,
"qState": "L"
}
],
[
{
"qText": "2",
"qNum": 2,
"qElemNumber": 1,
"qState": "S"
},
{
"qText": "63",
"qNum": 63,
"qElemNumber": 5,
"qState": "S"
},
{
"qText": "3420,005",
"qNum": 3420.005,
"qElemNumber": 0,
"qState": "L"
}
]
],
"qTails": [
{
"qUp": 0,
"qDown": 0
},
{
"qUp": 0,
"qDown": 0
}
],
"qArea": {
"qLeft": 0,
"qTop": 0,
"qWidth": 3,
"qHeight": 3
}
},
{
"qMatrix": [],
"qTails": [],
"qArea": {
"qLeft": 0,
"qTop": 0,
"qWidth": 0,
"qHeight": 0
}
},
{
"qMatrix": [],
"qTails": [],
"qArea": {
"qLeft": 0,
"qTop": 0,
"qWidth": 0,
"qHeight": 0
}
}
],
"qPivotDataPages": [],
"qStackedDataPages": [],
"qMode": "S"
}
}
}
}
Values relative to rows: (0,2 and 4) and to columns: (0 and 1) are selected. For more information on the parameters returned, see GetLayout method. qMode is S because the chart is represented as a straight table internally in the engine.
After the selections, if the data were represented in a table, we would have the following:
Example table data
CategoryID |
ProductID |
Sum([OrderTotal]) |
1 |
76 |
1416.35 |
2 |
77 |
2027.376 |
2 |
63 |
3420.005 |