@datarailsshared/dr_renderer 1.2.440 → 1.2.441
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
@@ -2090,6 +2090,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
2090
2090
|
highchartsRenderer.setYAxisMinMax(chartOptions.yAxis[1], opts.comboOptions.secondaryAxisSettings);
|
2091
2091
|
};
|
2092
2092
|
|
2093
|
+
/**
|
2094
|
+
* @deprecated Basic Pie Chart has been deprecated. Please use PieWithDrilldown instead.
|
2095
|
+
*/
|
2096
|
+
|
2093
2097
|
highchartsRenderer.ptRenderBasicPie = function (pivotData, opts) {
|
2094
2098
|
var chartOptions = {};
|
2095
2099
|
var additionOptions = opts.chartOptions ? opts.chartOptions : highchartsRenderer.getDefaultValueForChart('pie-chart');
|
@@ -8426,6 +8426,80 @@ describe('highcharts_renderer', () => {
|
|
8426
8426
|
});
|
8427
8427
|
});
|
8428
8428
|
|
8429
|
+
describe('highchartsRenderer.ptRenderBasicPie', () => {
|
8430
|
+
const pivotData = {
|
8431
|
+
getColKeys: jest.fn(() => [['Category 1'], ['Category 2']]),
|
8432
|
+
getRowKeys: jest.fn(() => [['Row 1'], ['Row 2']]),
|
8433
|
+
getAggregator: jest.fn(() => ({ value: jest.fn(() => 100) }))
|
8434
|
+
};
|
8435
|
+
|
8436
|
+
const opts = {
|
8437
|
+
chartOptions: {
|
8438
|
+
label_pie: { show: true, overlap: true },
|
8439
|
+
chart: { colors_offset: 1 },
|
8440
|
+
hideChartHeader: false
|
8441
|
+
},
|
8442
|
+
drillDownListFunc: jest.fn()
|
8443
|
+
};
|
8444
|
+
|
8445
|
+
beforeEach(() => {
|
8446
|
+
jest.spyOn(highchartsRenderer, 'ptCreateElementAndDraw').mockImplementation(() => {});
|
8447
|
+
jest.spyOn(highchartsRenderer, 'getFormattedColKey').mockImplementation((name) => `Formatted ${name}`);
|
8448
|
+
});
|
8449
|
+
|
8450
|
+
afterEach(() => {
|
8451
|
+
jest.restoreAllMocks();
|
8452
|
+
});
|
8453
|
+
|
8454
|
+
it('should call ptCreateElementAndDraw with correct chart options', () => {
|
8455
|
+
highchartsRenderer.ptRenderBasicPie(pivotData, opts);
|
8456
|
+
|
8457
|
+
expect(highchartsRenderer.ptCreateElementAndDraw).toHaveBeenCalledWith(
|
8458
|
+
expect.objectContaining({
|
8459
|
+
chart: expect.objectContaining({
|
8460
|
+
type: 'pie'
|
8461
|
+
}),
|
8462
|
+
colors: expect.arrayContaining(["#91e7e7", "#f37789"]),
|
8463
|
+
plotOptions: expect.objectContaining({
|
8464
|
+
pie: expect.objectContaining({
|
8465
|
+
allowPointSelect: true,
|
8466
|
+
cursor: 'pointer',
|
8467
|
+
dataLabels: expect.objectContaining({
|
8468
|
+
enabled: true,
|
8469
|
+
allowOverlap: true,
|
8470
|
+
style: expect.objectContaining({
|
8471
|
+
fontFamily: "Poppins",
|
8472
|
+
fontSize: "11",
|
8473
|
+
fontWeight: "normal"
|
8474
|
+
})
|
8475
|
+
}),
|
8476
|
+
showInLegend: true
|
8477
|
+
})
|
8478
|
+
}),
|
8479
|
+
series: expect.arrayContaining([
|
8480
|
+
expect.objectContaining({
|
8481
|
+
name: 'Row 1',
|
8482
|
+
colorByPoint: true,
|
8483
|
+
data: expect.arrayContaining([
|
8484
|
+
expect.objectContaining({
|
8485
|
+
initialName: ["Category 1"],
|
8486
|
+
name: 'Formatted Category 1',
|
8487
|
+
y: 100
|
8488
|
+
}),
|
8489
|
+
expect.objectContaining({
|
8490
|
+
initialName: ["Category 2"],
|
8491
|
+
name: 'Formatted Category 2',
|
8492
|
+
y: 100
|
8493
|
+
})
|
8494
|
+
])
|
8495
|
+
})
|
8496
|
+
])
|
8497
|
+
}),
|
8498
|
+
opts
|
8499
|
+
);
|
8500
|
+
});
|
8501
|
+
});
|
8502
|
+
|
8429
8503
|
describe('Function ptRenderGauge', () => {
|
8430
8504
|
|
8431
8505
|
const pivotDataMock = {
|