sapenlinea-components 0.9.75 → 0.9.76

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.
@@ -5135,6 +5135,82 @@ function getTotal(data) {
5135
5135
  function buildDonutChartOptions(data) {
5136
5136
  const total = getTotal(data);
5137
5137
  const showLegend = data.length > 10;
5138
+ const splitLegend = data.length > 14;
5139
+ let legendConfig = {};
5140
+ if (showLegend) {
5141
+ if (splitLegend) {
5142
+ const half = Math.ceil(data.length / 2);
5143
+ const leftData = data.slice(0, half).map(d => d.label);
5144
+ const rightData = data.slice(half).map(d => d.label);
5145
+ legendConfig = {
5146
+ legend: [
5147
+ {
5148
+ data: leftData,
5149
+ type: 'scroll',
5150
+ orient: 'vertical',
5151
+ left: '5%',
5152
+ top: 'center',
5153
+ itemWidth: 12,
5154
+ itemHeight: 12,
5155
+ itemGap: 10,
5156
+ textStyle: {
5157
+ fontSize: 11,
5158
+ fontFamily: UI_CHART_TOKENS.fontFamily,
5159
+ color: UI_CHART_TOKENS.muted,
5160
+ },
5161
+ pageTextStyle: { color: UI_CHART_TOKENS.muted },
5162
+ pageIconColor: UI_CHART_TOKENS.centerText,
5163
+ pageIconInactiveColor: '#ccc',
5164
+ },
5165
+ {
5166
+ data: rightData,
5167
+ type: 'scroll',
5168
+ orient: 'vertical',
5169
+ right: '5%',
5170
+ top: 'center',
5171
+ itemWidth: 12,
5172
+ itemHeight: 12,
5173
+ itemGap: 10,
5174
+ textStyle: {
5175
+ fontSize: 11,
5176
+ fontFamily: UI_CHART_TOKENS.fontFamily,
5177
+ color: UI_CHART_TOKENS.muted,
5178
+ },
5179
+ pageTextStyle: { color: UI_CHART_TOKENS.muted },
5180
+ pageIconColor: UI_CHART_TOKENS.centerText,
5181
+ pageIconInactiveColor: '#ccc',
5182
+ }
5183
+ ]
5184
+ };
5185
+ }
5186
+ else {
5187
+ legendConfig = {
5188
+ legend: {
5189
+ type: 'scroll',
5190
+ orient: 'vertical',
5191
+ right: '5%',
5192
+ top: 'center',
5193
+ itemWidth: 12,
5194
+ itemHeight: 12,
5195
+ itemGap: 10,
5196
+ textStyle: {
5197
+ fontSize: 11,
5198
+ fontFamily: UI_CHART_TOKENS.fontFamily,
5199
+ color: UI_CHART_TOKENS.muted,
5200
+ },
5201
+ pageTextStyle: {
5202
+ color: UI_CHART_TOKENS.muted,
5203
+ },
5204
+ pageIconColor: UI_CHART_TOKENS.centerText,
5205
+ pageIconInactiveColor: '#ccc',
5206
+ }
5207
+ };
5208
+ }
5209
+ }
5210
+ let centerX = '50%';
5211
+ if (showLegend) {
5212
+ centerX = splitLegend ? '50%' : '35%';
5213
+ }
5138
5214
  return {
5139
5215
  animation: true,
5140
5216
  backgroundColor: 'transparent',
@@ -5164,32 +5240,12 @@ function buildDonutChartOptions(data) {
5164
5240
  `,
5165
5241
  formatter: (params) => `${params.name}: ${params.value}`,
5166
5242
  },
5167
- ...(showLegend ? {
5168
- legend: {
5169
- type: 'scroll',
5170
- orient: 'horizontal',
5171
- bottom: 0,
5172
- left: 'center',
5173
- itemWidth: 12,
5174
- itemHeight: 12,
5175
- itemGap: 10,
5176
- textStyle: {
5177
- fontSize: 11,
5178
- fontFamily: UI_CHART_TOKENS.fontFamily,
5179
- color: UI_CHART_TOKENS.muted,
5180
- },
5181
- pageTextStyle: {
5182
- color: UI_CHART_TOKENS.muted,
5183
- },
5184
- pageIconColor: UI_CHART_TOKENS.centerText,
5185
- pageIconInactiveColor: '#ccc',
5186
- },
5187
- } : {}),
5243
+ ...legendConfig,
5188
5244
  series: [
5189
5245
  {
5190
5246
  type: 'pie',
5191
5247
  radius: ['44%', '72%'],
5192
- center: ['50%', showLegend ? '46%' : '52%'],
5248
+ center: [centerX, '50%'],
5193
5249
  avoidLabelOverlap: true,
5194
5250
  minAngle: 4,
5195
5251
  itemStyle: {
@@ -5242,21 +5298,19 @@ function buildDonutChartOptions(data) {
5242
5298
  })),
5243
5299
  },
5244
5300
  ],
5245
- graphic: [
5246
- {
5247
- type: 'text',
5248
- left: 'center',
5249
- top: showLegend ? '42%' : '48%',
5250
- style: {
5251
- text: `${total}`,
5252
- textAlign: 'center',
5253
- fill: UI_CHART_TOKENS.centerText,
5254
- fontSize: 24,
5255
- fontWeight: 700,
5256
- fontFamily: UI_CHART_TOKENS.fontFamily,
5257
- },
5301
+ title: {
5302
+ text: `${total}`,
5303
+ left: centerX,
5304
+ top: '48%',
5305
+ textAlign: 'center',
5306
+ textVerticalAlign: 'middle',
5307
+ textStyle: {
5308
+ color: UI_CHART_TOKENS.centerText,
5309
+ fontSize: 24,
5310
+ fontWeight: 700,
5311
+ fontFamily: UI_CHART_TOKENS.fontFamily,
5258
5312
  },
5259
- ],
5313
+ },
5260
5314
  };
5261
5315
  }
5262
5316
  class DonutChart {
@@ -5394,6 +5448,7 @@ function buildHeatmapOptions(config) {
5394
5448
  visualMap: {
5395
5449
  min: minVal,
5396
5450
  max: maxVal,
5451
+ calculable: false,
5397
5452
  orient: 'horizontal',
5398
5453
  left: 'center',
5399
5454
  bottom: '0',