Muhammad Saleem

Muhammad Saleem

  • 1.7k
  • 83
  • 614

how to add header above of columns header in webdatarocks

Aug 7 2023 11:54 AM

how can i add header above of columns header using webdatarocks

this is my sample code which i'm using


var report = { 
         "dataSource": { 
                     "data": Josndata, 
                     "excelSheetName": Report${exportFormatDate(new Date())}`, 
                    "type": "elasticsearch", 
                     "mapping": { "Column1": { "type": "string" }, 
                                  "Column2": { "type": "string" },   
                                  "Column3": { "type": "string" }, 
                                  "Column4": { "type": "number", }, 
                                  "Column5": { "type": "number", }, 
                                  "Column6": { "type": "number", } } }, 
        "slice": {

        "reportFilters": [
            // Top Filter
            {
                "uniqueName": "Column1", "caption": "Column 1",
            },
            {
                "uniqueName": "Column3", "caption": "Column 3",
            },
            {
                "uniqueName": "Column2", "caption": "Column2",
            }
        ],
        "rows": [
            {
                "uniqueName": "Column1",
            },
            {
                "uniqueName": "Column2",
            }
        ],
        "expands": { expandAll: true },

        "columns": [
            {
                "uniqueName": "[Measures]" 
            },
            {
                "uniqueName": "Column3",
                "sort": "unsorted"
            }
        ],
        "measures": [
            {
                uniqueName: "Column4",
                aggregation: "sum",
                active: true,
                caption: "Column 4"
            },
            {
                uniqueName: "Column5",
                aggregation: "sum",
                active: true,
                caption: "Column 5"
            },
            {
                uniqueName: "Column6",
                formula: "\"Column4\"*100 / \"Column5\" %",
                active: true,
                caption: "Column 6",
                format: "customFormat"
            }
        ],
        "sorting": {
            "column": {
                "type": "desc",
                "tuple": [],
                "measure": {
                    "uniqueName": "Budget_FieldDays",
                    "aggregation": "sum"
                }
            }
        },
        "drillThrough": [
           "Column1",
           "Column2",
           "Column3",
           "Column4",               
           "Column5",
           "Column6",
        ]
    
    },
    "formats": [ 
        {
            "decimalSeparator": ".",
            "decimalPlaces": 0,
            "thousandsSeparator": ",",
            name: "customFormat",
            currencySymbol: "%",
            currencySymbolAlign: "right",
            nullValue: "",
            textAlign: "right",
            isPercent: false
        }
    ],
    "options": {
        "grid": {
            "type": "classic",
            "showTotals": "off",
            "showGrandTotals": "off" //rows
        },
        showAggregationLabels: false

    }
 

}

BindWebDataRocksPivot(report, true, "100%", "1000", "#pivot-container");

 

this end result that I want 


Answers (2)