@datarailsshared/dr_renderer 1.2.439 → 1.2.440

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarailsshared/dr_renderer",
3
- "version": "1.2.439",
3
+ "version": "1.2.440",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -8321,6 +8321,111 @@ describe('highcharts_renderer', () => {
8321
8321
  });
8322
8322
  });
8323
8323
 
8324
+ describe('highchartsRenderer.ptRenderPieWithDrillDown', () => {
8325
+ beforeEach(() => {
8326
+ jest.spyOn(highchartsRenderer, 'ptCreateSeriesToDrillDownChart')
8327
+ .mockReturnValue([{ name: 'Sample Series', data: [1, 2, 3] }]);
8328
+ jest.spyOn(highchartsRenderer, 'ptCreateElementAndDraw').mockImplementation(() => {});
8329
+ });
8330
+
8331
+ afterEach(() => {
8332
+ jest.restoreAllMocks();
8333
+ });
8334
+
8335
+ it('should call ptCreateElementAndDraw with correct chart options', () => {
8336
+ const pivotData = {
8337
+ getColKeys: jest.fn(() => [['Category 1'], ['Category 2']]),
8338
+ getRowKeys: jest.fn(() => [['Row 1'], ['Row 2']]),
8339
+ isDrillDownDisabled: false,
8340
+ getAggregator: jest.fn((row, col) => ({
8341
+ value: jest.fn(() => 100)
8342
+ })),
8343
+ rows: { 0: { type: 'Date' }, 1: { type: 'Date' } },
8344
+ cols: { 0: { type: 'Category' }, 1: { type: 'Category' } }
8345
+ };
8346
+
8347
+ const opts = {
8348
+ chartOptions: {
8349
+ label_pie: {
8350
+ overlap: true,
8351
+ show: true
8352
+ },
8353
+ chart: {
8354
+ colors_offset: 1
8355
+ }
8356
+ }
8357
+ };
8358
+
8359
+ const drilldownFunc = jest.fn();
8360
+
8361
+ highchartsRenderer.ptRenderPieWithDrillDown(pivotData, opts, drilldownFunc);
8362
+
8363
+ const expectedChartOptions = {
8364
+ chart: {
8365
+ type: 'pie',
8366
+ events: {
8367
+ drilldown: expect.any(Function),
8368
+ drillup: expect.any(Function)
8369
+ }
8370
+ },
8371
+ colors: ["#91e7e7", "#f37789", "#ffdc65", "#0e569d", "#bbe0ff", "#57b2ff", "#5ecfb9", "#c7ffda", "#179ab9", "#008aff"],
8372
+ plotOptions: {
8373
+ series: {
8374
+ animation: true,
8375
+ dataLabels: {
8376
+ allowOverlap: true,
8377
+ color: "#151a41",
8378
+ enabled: true,
8379
+ formatter: expect.any(Function),
8380
+ style: {
8381
+ "fontFamily": "Poppins",
8382
+ "fontSize": "11",
8383
+ "fontWeight": "normal"
8384
+ }
8385
+ },
8386
+ showInLegend: true
8387
+ }
8388
+ },
8389
+ tooltip: {
8390
+ headerFormat: '',
8391
+ pointFormatter: expect.any(Function)
8392
+ },
8393
+ series: [{ name: 'Sample Series', data: [1, 2, 3] }],
8394
+ legend: {
8395
+ align: "right",
8396
+ borderWidth: 0,
8397
+ enabled: true,
8398
+ itemMarginTop: 10,
8399
+ layout: "vertical",
8400
+ verticalAlign: "top",
8401
+ y: 13
8402
+ },
8403
+ drilldown: {},
8404
+ subtitle: {
8405
+ align: "center",
8406
+ style: {
8407
+ "color": "#2969b0",
8408
+ "font-family": "'Poppins', sans-serif",
8409
+ "font-size": "14px",
8410
+ "font-weight": "100"
8411
+ },
8412
+ text: ""
8413
+ },
8414
+ title: {
8415
+ align: "center",
8416
+ style: {
8417
+ "color": "#2969b0",
8418
+ "font-family": "'Poppins', sans-serif",
8419
+ "font-size": "18px",
8420
+ "font-weight": "300"
8421
+ },
8422
+ text: ""
8423
+ }
8424
+ };
8425
+ expect(highchartsRenderer.ptCreateElementAndDraw).toHaveBeenCalledWith(expectedChartOptions, opts);
8426
+ });
8427
+ });
8428
+
8324
8429
  describe('Function ptRenderGauge', () => {
8325
8430
 
8326
8431
  const pivotDataMock = {