@carbon/charts-vue 1.6.8 → 1.6.13

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/charts-vue.umd.js CHANGED
@@ -24136,7 +24136,14 @@ var tooltip_Tooltip = /** @class */ (function (_super) {
24136
24136
  _this.positionService = new utils_position();
24137
24137
  _this.handleShowTooltip = function (e) {
24138
24138
  var data = e.detail.data || e.detail.items;
24139
- var defaultHTML = _this.getTooltipHTML(e);
24139
+ var defaultHTML;
24140
+ var formattedItems = _this.formatItems(_this.getItems(e));
24141
+ if (e.detail.content) {
24142
+ defaultHTML = "<div class=\"title-tooltip\"><p>" + e.detail.content + "</p></div>";
24143
+ }
24144
+ else {
24145
+ defaultHTML = _this.getTooltipHTML(formattedItems);
24146
+ }
24140
24147
  var tooltipTextContainer = dom_utils_DOMUtils.appendOrSelect(_this.tooltip, 'div.content-box');
24141
24148
  // if there is a provided tooltip HTML function call it
24142
24149
  if (tools_Tools.getProperty(_this.getOptions(), 'tooltip', 'customHTML')) {
@@ -24154,6 +24161,18 @@ var tooltip_Tooltip = /** @class */ (function (_super) {
24154
24161
  // Use default tooltip
24155
24162
  tooltipTextContainer.html(defaultHTML);
24156
24163
  }
24164
+ // Apply custom background colors
24165
+ tooltipTextContainer
24166
+ .selectAll('.datapoint-tooltip')
24167
+ .each(function (datum, i) {
24168
+ var item = formattedItems[i];
24169
+ if (formattedItems[i] && formattedItems[i].color) {
24170
+ src_select(this)
24171
+ .select('.tooltip-color')
24172
+ .attr('class', 'tooltip-color')
24173
+ .style('background-color', item.color);
24174
+ }
24175
+ });
24157
24176
  // Position the tooltip
24158
24177
  _this.positionTooltip(e);
24159
24178
  // Fade in
@@ -24224,31 +24243,18 @@ var tooltip_Tooltip = /** @class */ (function (_super) {
24224
24243
  }
24225
24244
  return items;
24226
24245
  };
24227
- Tooltip.prototype.getTooltipHTML = function (e) {
24228
- var defaultHTML;
24229
- if (e.detail.content) {
24230
- defaultHTML = "<div class=\"title-tooltip\"><p>" + e.detail.content + "</p></div>";
24231
- }
24232
- else {
24233
- var items = this.getItems(e);
24234
- var formattedItems = this.formatItems(items);
24235
- defaultHTML =
24236
- "<ul class=\"multi-tooltip\">" +
24237
- formattedItems
24238
- .map(function (item) {
24239
- return "<li>\n\t\t\t\t\t\t\t<div class=\"datapoint-tooltip " + (item.bold ? 'bold' : '') + "\">\n\t\t\t\t\t\t\t\t" + (item.class ? "<div class=\"tooltip-color " + item.class + "\"></div>" : '') + "\n\t\t\t\t\t\t\t\t" + (item.color
24240
- ? '<div style="background-color: ' +
24241
- item.color +
24242
- '" class="tooltip-color"></div>'
24243
- : '') + "\n\t\t\t\t\t\t\t\t<div class=\"label\">\n\t\t\t\t\t\t\t\t<p>" + (item.label || '') + "</p>\n\t\t\t\t\t\t\t\t" + (item.labelIcon ? "<span class=\"label-icon\"/>" + item.labelIcon + "</span>" : '') + "\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t" + (item.value === undefined ||
24244
- item.value === null
24245
- ? ''
24246
- : "<p class=\"value\"/>" + item.value + "</p>") + "\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</li>";
24247
- })
24248
- .join('') +
24249
- "</ul>";
24250
- }
24251
- return defaultHTML;
24246
+ Tooltip.prototype.getTooltipHTML = function (formattedItems) {
24247
+ return ("<ul class=\"multi-tooltip\">" +
24248
+ formattedItems
24249
+ .map(function (item) {
24250
+ return "<li>\n\t\t\t\t\t<div class=\"datapoint-tooltip" + (item.bold ? ' bold' : '') + "\">\n\t\t\t\t\t\t" + (item.class || item.color
24251
+ ? "<div class=\"tooltip-color " + item.class + "\"></div>"
24252
+ : '') + "\n\t\t\t\t\t\t<div class=\"label\">\n\t\t\t\t\t\t<p>" + (item.label || '') + "</p>\n\t\t\t\t\t\t" + (item.labelIcon ? "<span class=\"label-icon\"/>" + item.labelIcon + "</span>" : '') + "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t" + (item.value === undefined || item.value === null
24253
+ ? ''
24254
+ : "<p class=\"value\"/>" + item.value + "</p>") + "\n\t\t\t\t\t</div>\n\t\t\t\t</li>";
24255
+ })
24256
+ .join('') +
24257
+ "</ul>");
24252
24258
  };
24253
24259
  Tooltip.prototype.valueFormatter = function (value, label) {
24254
24260
  var options = this.getOptions();
@@ -36375,13 +36381,13 @@ var axis_Axis = /** @class */ (function (_super) {
36375
36381
  container
36376
36382
  .selectAll('g.ticks g.tick text')
36377
36383
  .attr('transform', "rotate(-45)")
36378
- .style('text-anchor', axisPosition === AxisPositions.TOP ? 'start' : 'end');
36384
+ .attr('text-anchor', axisPosition === AxisPositions.TOP ? 'start' : 'end');
36379
36385
  }
36380
36386
  else {
36381
36387
  container
36382
36388
  .selectAll('g.ticks g.tick text')
36383
36389
  .attr('transform', null)
36384
- .style('text-anchor', null);
36390
+ .attr('text-anchor', null);
36385
36391
  }
36386
36392
  }
36387
36393
  // we don't need to show axes on empty state and on skeleton state