{ "title": "Add Second Category Buttons To Widget", "oid": "66674c285aea8a00336736f7", "desc": "", "source": null, "type": "dashboard", "style": { "palette": { "name": "Basic", "colors": [ "#3471AD", "#F66500", "#FFC400", "#42BC39" ] } }, "layout": { "instanceid": "F4FAF-4EB9-D8", "type": "columnar", "columns": [ { "width": 100, "cells": [ { "subcells": [ { "elements": [ { "minHeight": 96, "maxHeight": 2048, "minWidth": 128, "maxWidth": 2048, "defaultWidth": 512, "widgetid": "6667526a5aea8a0033673729", "height": "612px" } ], "width": 100, "stretchable": false, "pxlWidth": 1217.47, "index": 0 } ] } ], "pxlWidth": 1217.47, "index": 0 } ], "container": { "sizzle1718049819586": { "undefined": { "parentNode": [ 110.23353518423566, 33, true ] } } } }, "original": null, "dataExploration": false, "lastOpened": null, "previewLayout": [], "datasource": { "address": "LocalHost", "title": "Sample ECommerce", "id": "localhost_aSampleIAAaECommerce", "database": "aSampleIAAaECommerce", "fullname": "localhost/Sample ECommerce", "live": false }, "filters": [], "editing": true, "parentFolder": "6658b73e5aea8a0033672cde", "settings": { "autoUpdateOnFiltersChange": true }, "filterRelations": [], "filterToDatasourceMapping": {}, "widgets": [ { "title": "", "type": "chart/column", "subtype": "column/classic", "oid": "6667526a5aea8a0033673729", "desc": null, "source": null, "datasource": { "address": "LocalHost", "title": "Sample ECommerce", "id": "localhost_aSampleIAAaECommerce", "database": "aSampleIAAaECommerce", "fullname": "localhost/Sample ECommerce", "live": false }, "selection": null, "metadata": { "drillHistory": [ { "jaql": { "table": "Country", "column": "Country", "dim": "[Country.Country]", "datatype": "text", "merged": true, "title": "Country" }, "parent": { "jaql": { "table": "Commerce", "column": "Age Range", "dim": "[Commerce.Age Range]", "datatype": "text", "merged": true, "title": "Age Range" }, "instanceid": "109DD-BA8E-FD", "panel": "rows" }, "through": { "jaql": { "datatype": "text", "dim": "[Commerce.Age Range]", "title": "Age Range", "column": "Age Range", "table": "Commerce", "filter": { "explicit": true, "multiSelection": true, "members": [ "35-44" ] } } }, "panel": "rows" }, { "jaql": { "table": "Commerce", "column": "Age Range", "dim": "[Commerce.Age Range]", "datatype": "text", "merged": true, "title": "Age Range" }, "parent": { "jaql": { "table": "Brand", "column": "Brand", "dim": "[Brand.Brand]", "datatype": "text", "merged": true, "title": "Brand" }, "parent": { "jaql": { "table": "Commerce", "column": "Age Range", "dim": "[Commerce.Age Range]", "datatype": "text", "merged": true, "title": "Age Range" }, "instanceid": "109DD-BA8E-FD", "panel": "rows" }, "through": { "jaql": { "datatype": "text", "dim": "[Commerce.Age Range]", "title": "Age Range", "column": "Age Range", "table": "Commerce", "filter": { "explicit": true, "multiSelection": true, "members": [ "35-44" ] } } }, "panel": "rows" }, "through": { "jaql": { "datatype": "text", "dim": "[Brand.Brand]", "title": "Brand", "column": "Brand", "table": "Brand", "filter": { "explicit": true, "multiSelection": true, "members": [ "Reseller" ] } } }, "panel": "rows" }, { "jaql": { "table": "Brand", "column": "Brand", "dim": "[Brand.Brand]", "datatype": "text", "merged": true, "title": "Brand" }, "parent": { "jaql": { "table": "Commerce", "column": "Age Range", "dim": "[Commerce.Age Range]", "datatype": "text", "merged": true, "title": "Age Range" }, "instanceid": "109DD-BA8E-FD", "panel": "rows" }, "through": { "jaql": { "datatype": "text", "dim": "[Commerce.Age Range]", "title": "Age Range", "column": "Age Range", "table": "Commerce", "filter": { "explicit": true, "multiSelection": true, "members": [ "35-44" ] } } }, "panel": "rows" }, { "jaql": { "table": "Commerce", "column": "Gender", "dim": "[Commerce.Gender]", "datatype": "text", "merged": true, "title": "Gender1" }, "parent": { "jaql": { "table": "Commerce", "column": "Age Range", "dim": "[Commerce.Age Range]", "datatype": "text", "merged": true, "title": "Age Range" }, "instanceid": "109DD-BA8E-FD", "panel": "rows" }, "through": { "jaql": { "datatype": "text", "dim": "[Commerce.Age Range]", "title": "Age Range", "column": "Age Range", "table": "Commerce", "filter": { "explicit": true, "multiSelection": true, "members": [ "0-18", "19-24", "25-34", "35-44", "45-54", "55-64", "65+" ] } } }, "panel": "rows" } ], "ignore": { "dimensions": [], "ids": [], "all": false }, "panels": [ { "name": "categories", "items": [ { "jaql": { "table": "Commerce", "column": "Age Range", "dim": "[Commerce.Age Range]", "datatype": "text", "merged": true, "title": "Age Range" }, "instanceid": "109DD-BA8E-FD", "panel": "rows" }, { "jaql": { "table": "Category", "column": "Category", "dim": "[Category.Category]", "datatype": "text", "merged": true, "title": "Category" }, "instanceid": "8235A-5A3B-34", "panel": "rows", "disabled": true, "format": { "mask": { "years": "yyyy", "quarters": "yyyy Q", "months": "MM/yyyy", "weeks": "ww yyyy", "days": "shortDate", "minutes": "HH:mm", "seconds": "MM/dd/yyyy HH:mm:ss", "dateAndTime": "MM/dd/yyyy HH:mm", "isdefault": true } } } ] }, { "name": "values", "items": [ { "jaql": { "table": "Commerce", "column": "Revenue", "dim": "[Commerce.Revenue]", "datatype": "numeric", "agg": "sum", "title": "Total Revenue" }, "instanceid": "3BB58-692B-E4", "panel": "measures", "field": { "id": "[Commerce.Revenue]_sum", "index": 1 }, "format": { "mask": { "type": "number", "abbreviations": { "t": true, "b": true, "m": true, "k": true }, "separated": true, "decimals": "auto", "abbreviateAll": false, "isdefault": true }, "color": { "colorIndex": 0, "type": "color" } }, "disabled": false } ] }, { "name": "break by", "items": [] }, { "name": "filters", "items": [] } ], "usedFormulasMapping": {} }, "style": { "legend": { "enabled": true, "position": "bottom" }, "seriesLabels": { "enabled": true, "rotation": 0, "labels": { "enabled": false, "types": { "count": false, "percentage": false, "relative": false, "totals": false }, "stacked": false, "stackedPercentage": false } }, "xAxis": { "enabled": true, "ticks": true, "labels": { "enabled": true, "rotation": 0 }, "title": { "enabled": false }, "x2Title": { "enabled": false }, "gridLines": true, "isIntervalEnabled": false }, "yAxis": { "inactive": false, "enabled": true, "ticks": true, "labels": { "enabled": true, "rotation": 0 }, "title": { "enabled": false }, "gridLines": true, "logarithmic": false, "hideMinMax": false, "isIntervalEnabled": true }, "y2Axis": { "inactive": true, "enabled": true, "ticks": true, "labels": { "enabled": true, "rotation": 0 }, "title": { "enabled": false }, "gridLines": false, "logarithmic": false, "hideMinMax": false, "isIntervalEnabled": true }, "navigator": { "enabled": true }, "dataLimits": { "seriesCapacity": 50, "categoriesCapacity": 100000 }, "lineWidth": { "width": "bold" }, "markers": { "enabled": false, "fill": "filled", "size": "small" }, "narration": { "enabled": false, "display": "above", "format": "bullets", "verbosity": "medium", "up_sentiment": "good", "aggregation": "sum", "labels": [ { "id": "age_range", "title": "Age Range", "singular": "Age Range", "plural": "Age Range" }, { "id": "gender", "title": "Gender", "singular": "Gender", "plural": "Gender" } ] } }, "instanceid": "42496-665D-3E", "drillToDashboardConfig": { "drilledDashboardPrefix": "_drill", "drilledDashboardsFolderPrefix": "", "displayFilterPane": true, "displayDashboardsPane": true, "displayToolbarRow": true, "displayHeaderRow": true, "volatile": false, "hideDrilledDashboards": true, "hideSharedDashboardsForNonOwner": true, "drillToDashboardMenuCaption": "Jump to dashboard", "drillToDashboardRightMenuCaption": "Jump to ", "drillToDashboardNavigateType": 1, "drillToDashboardNavigateTypePivot": 2, "drillToDashboardNavigateTypeCharts": 1, "drillToDashboardNavigateTypeOthers": 3, "excludeFilterDims": [], "includeFilterDims": [], "drilledDashboardDisplayType": 2, "dashboardIds": [], "modalWindowResize": false, "showFolderNameOnMenuSelection": false, "resetDashFiltersAfterJTD": false, "sameCubeRestriction": true, "showJTDIcon": true, "sendPieChartMeasureFiltersOnClick": true, "forceZeroInsteadNull": false, "mergeTargetDashboardFilters": false, "drillToDashboardByName": false }, "wasRendered": false, "realTimeRefreshing": false, "script": "/*\nWelcome to your Widget's Script.\n\nTo learn how you can access the Widget and Dashboard objects, see the online documentation at https://sisense.dev/guides/js/extensions\n*/\n\n//Define the drilling options' title in a list of constants like shown below\nconst drillOption1Title = 'Year'\nconst drillOption2Title = 'Gender'\nconst drillOption3Title = 'Country'\nconst drillOption4Title = 'Category'\n\n//Define the drilling options' JAQL in a list of constants like shown below\nconst drillOption1JAQL = {\n \"table\": \"Commerce\",\n \"column\": \"Date\",\n \"dim\": \"[Commerce.Date (Calendar)]\",\n \"datatype\": \"datetime\",\n \"merged\": true,\n \"level\": \"years\",\n \"title\": \"Years in Date\"\n}\n\nconst drillOption2JAQL = {\n \"table\": \"Commerce\",\n \"column\": \"Gender\",\n \"dim\": \"[Commerce.Gender]\",\n \"datatype\": \"text\",\n \"merged\": true,\n \"title\": \"Gender\"\n}\n\nconst drillOption3JAQL = {\n \"table\": \"Country\",\n \"column\": \"Country\",\n \"dim\": \"[Country.Country]\",\n \"datatype\": \"text\",\n \"merged\": true,\n \"title\": \"Country\"\n}\n\nconst drillOption4JAQL = {\n \"table\": \"Category\",\n \"column\": \"Category\",\n \"dim\": \"[Category.Category]\",\n \"datatype\": \"text\",\n \"merged\": true,\n \"title\": \"Category\"\n}\n\n//Set margin for the buttons\nwidget.on('processresult', function(se, ev){\t\n\tev.result.chart.marginTop = 90;\n});\n\nvar selectedDrillOption = 'None';\n\nwidget.on(\"domready\", function(w, args){\n\t\n\tchart = w.chart[0][Object.keys(w.chart[0])[0]].hc;\n\t\n\tchart.renderer.label('Drill into:
' + '' + selectedDrillOption + '', 30, 10)\n .css({\n fontSize: '14px'\n })\n .attr({\n\t\t\tzIndex : 10,\n\t\t\theight: 15,\n\t\t\twidth: 50,\n\t\t\t'text-align': 'center'\n })\n .add();\n\t\n\tchart.renderer.button('None', 120, 10)\n\t\t.attr({\n\t\t\tzIndex : 10,\n\t\t\theight: 15,\n\t\t\twidth: 50,\n\t\t\t'text-align': 'center'\n\t\t})\n\t\t.on('click', function() {\n\t\t\tselectedDrillOption = 'None';\n\t\t\twidget.metadata.panels[0].items[1].disabled = true;\n\t\t\twidget.refresh();\n\t\t})\n\t\t.add();\n\t\n\tchart.renderer.button(drillOption1Title, 200, 10)\n\t\t.attr({\n\t\t\tzIndex : 10,\n\t\t\theight: 15,\n\t\t\twidth: 50,\n\t\t\t'text-align': 'center'\n\t\t})\n\t\t.on('click', function() {\n\t\t\tselectedDrillOption = drillOption1Title;\n\t\t\twidget.metadata.panels[0].items[1].disabled = false;\n\t\t\twidget.metadata.panels[0].items[1].jaql = drillOption1JAQL;\n\t\t\twidget.refresh();\n\t\t})\n\t\t.add();\n\t\t\n\tchart.renderer.button(drillOption2Title, 280, 10)\n\t\t.attr({\n\t\t\tzIndex : 10,\n\t\t\theight: 15,\n\t\t\twidth: 50,\n\t\t\t'text-align': 'center'\n\t\t})\n\t\t.on('click', function() {\n\t\t\tselectedDrillOption = drillOption2Title;\n\t\t\twidget.metadata.panels[0].items[1].disabled = false;\n\t\t\twidget.metadata.panels[0].items[1].jaql = drillOption2JAQL;\n\t\t\twidget.refresh();\n\t\t})\n\t\t.add();\n\t\n\tchart.renderer.button(drillOption3Title, 360, 10)\n\t\t.attr({\n\t\t\tzIndex : 10,\n\t\t\theight: 15,\n\t\t\twidth: 50,\n\t\t\t'text-align': 'center'\n\t\t})\n\t\t.on('click', function() {\n\t\t\tselectedDrillOption = drillOption3Title;\n\t\t\twidget.metadata.panels[0].items[1].disabled = false;\n\t\t\twidget.metadata.panels[0].items[1].jaql = drillOption3JAQL;\n\t\t\twidget.refresh();\n\t\t})\n\t\t.add();\n\t\n\tchart.renderer.button(drillOption4Title, 440, 10)\n\t\t.attr({\n\t\t\tzIndex : 10,\n\t\t\theight: 15,\n\t\t\twidth: 50,\n\t\t\t'text-align': 'center'\n\t\t})\n\t\t.on('click', function() {\n\t\t\tselectedDrillOption = drillOption4Title;\n\t\t\twidget.metadata.panels[0].items[1].disabled = false;\n\t\t\twidget.metadata.panels[0].items[1].jaql = drillOption4JAQL;\n\t\t\twidget.refresh();\n\t\t})\n\t\t.add();\n});", "options": { "dashboardFiltersMode": "filter", "selector": true, "triggersDomready": true, "autoUpdateOnEveryChange": true, "drillToAnywhere": true, "previousScrollerLocation": { "min": 0, "max": 201 }, "selectorLocked": false }, "dashboardid": "66674c285aea8a00336736f7" } ], "hierarchies": [ { "_id": "5e1df3c7d0c67e1ae07f1b28", "title": "Age Range", "alwaysIncluded": true, "levels": [ { "title": "Age Range", "table": "Commerce", "column": "Age Range", "datatype": "text", "dim": "[Commerce.Age Range]", "index": 0, "_id": "5e1df3c7d0c67e1ae07f1b27" }, { "title": "Brand", "table": "Brand", "column": "Brand", "datatype": "text", "dim": "[Brand.Brand]", "index": 1, "_id": "5f7dac8d83916d210422a29f" } ], "cubeId": "6142d757c80a065ff5a24ccc", "lastUpdated": "2023-12-17T10:23:52.992Z", "serverAddress": "LocalHost", "elasticubeTitle": "Sample ECommerce" }, { "_id": "5cbefc68bbb1712fe8ef043c", "title": "Age Range (1)", "alwaysIncluded": true, "levels": [ { "title": "Age Range", "table": "Commerce", "column": "Age Range", "datatype": "text", "dim": "[Commerce.Age Range]", "index": 0, "_id": "5cbefc68bbb1712fe8ef043b" }, { "title": "Gender", "table": "Commerce", "column": "Gender", "datatype": "text", "dim": "[Commerce.Gender]", "index": 1, "_id": "5cbefc6cbbb1712fe8ef043e" } ], "cubeId": "6142d757c80a065ff5a24ccc", "lastUpdated": "2023-12-17T10:23:52.992Z", "serverAddress": "LocalHost", "elasticubeTitle": "Sample ECommerce" }, { "_id": "5d6796518cb5d40ab82aa918", "title": "Age Range (1)", "alwaysIncluded": true, "levels": [ { "title": "Age Range", "table": "Commerce", "column": "Age Range", "datatype": "text", "dim": "[Commerce.Age Range]", "index": 0, "_id": "5d6796518cb5d40ab82aa917" }, { "title": "Cost", "table": "Commerce", "column": "Cost", "datatype": "numeric", "dim": "[Commerce.Cost]", "index": 1, "_id": "5d6796558cb5d40ab82aa91a" } ], "cubeId": "6142d757c80a065ff5a24ccc", "lastUpdated": "2023-12-17T10:23:52.992Z", "serverAddress": "LocalHost", "elasticubeTitle": "Sample ECommerce" }, { "_id": "5deaa26b55f2cb08c43cb908", "title": "Test1", "alwaysIncluded": true, "levels": [ { "title": "Category", "table": "Category", "column": "Category", "datatype": "text", "dim": "[Category.Category]", "index": 0, "_id": "5deaa26b55f2cb08c43cb907" }, { "title": "Brand", "table": "Brand", "column": "Brand", "datatype": "text", "dim": "[Brand.Brand]", "index": 1, "_id": "5deaa26f55f2cb08c43cb90a" }, { "title": "Country", "table": "Country", "column": "Country", "datatype": "text", "dim": "[Country.Country]", "index": 2, "_id": "5deaa27555f2cb08c43cb90c" } ], "cubeId": "6142d757c80a065ff5a24ccc", "lastUpdated": "2023-12-17T10:23:52.992Z", "serverAddress": "LocalHost", "elasticubeTitle": "Sample ECommerce" } ] }