@evergis/charts 2.0.87 → 2.0.91

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.
@@ -1,6 +1,6 @@
1
1
  import styled, { css, createGlobalStyle } from 'styled-components';
2
2
  import React, { useState, useCallback, useMemo, useEffect, useRef, Fragment } from 'react';
3
- import { select, pointer, min, max, scaleLinear, lineRadial, curveLinearClosed, range as range$1, format, arc, pie, create, quantize, interpolate, interpolateRound, quantile, axisBottom, group, utcFormat, scaleSequential, interpolateGreens, utcYear, utcMonths, utcMonth, utcSunday, utcMonday, axisLeft, line, curveLinear, area, scaleBand, sum } from 'd3';
3
+ import { select, pointer, min, max, scaleLinear, lineRadial, curveLinearClosed, range as range$1, format, arc, pie, create, quantize, interpolate, interpolateRound, quantile, axisBottom, group, utcFormat, scaleSequential, interpolateGreens, utcYear, utcMonths, utcMonth, utcSunday, utcMonday, axisLeft, line, curveLinear, area, scaleBand, sum, scaleLog } from 'd3';
4
4
  import ReactDOMServer from 'react-dom/server';
5
5
  import { unmountComponentAtNode, render } from 'react-dom';
6
6
 
@@ -3387,9 +3387,11 @@ const draw$5 = (node, props) => {
3387
3387
  maxYValue,
3388
3388
  drawGridY,
3389
3389
  drawGridX,
3390
+ xScaleLog,
3390
3391
  xScaleItemWidth,
3391
3392
  bubbleStyle,
3392
3393
  customize,
3394
+ yScaleLog,
3393
3395
  yScaleLabel,
3394
3396
  yScaleLabelPadding,
3395
3397
  enableTooltip,
@@ -3434,7 +3436,7 @@ const draw$5 = (node, props) => {
3434
3436
  return sizeValue;
3435
3437
  })]).range([minSize || bubbleChartDefaultProps.minSize, maxSize || bubbleChartDefaultProps.maxSize]);
3436
3438
  const yRange1 = height - marginTop - marginBottom - (xAxisPadding || 0);
3437
- const yScale = scaleLinear().domain([minY, maxY]).range([yRange1, marginTop]).nice();
3439
+ const yScale = yScaleLog ? scaleLog().domain([minY, maxY]).range([yRange1, marginTop]).nice() : scaleLinear().domain([minY, maxY]).range([yRange1, marginTop]).nice();
3438
3440
  customYScale && customYScale(yScale);
3439
3441
  const yTicks = yScale.ticks();
3440
3442
  const yAxisLeft = axisLeft(yScale).ticks(yTicksCountDefault);
@@ -3460,7 +3462,7 @@ const draw$5 = (node, props) => {
3460
3462
  width: yAxisWidth
3461
3463
  } = computeDimensions(yAxis);
3462
3464
  const range = [marginLeft + yAxisWidth + (yAxisPadding || 0) + yScaleLabelHeight, width - marginRight];
3463
- const xScale = scaleLinear().domain([min(data, _ref5 => {
3465
+ const xScale = xScaleLog ? scaleLog().domain([min(data, _ref5 => {
3464
3466
  let {
3465
3467
  xValue
3466
3468
  } = _ref5;
@@ -3470,6 +3472,16 @@ const draw$5 = (node, props) => {
3470
3472
  xValue
3471
3473
  } = _ref6;
3472
3474
  return xValue;
3475
+ })]).range(range) : scaleLinear().domain([min(data, _ref7 => {
3476
+ let {
3477
+ xValue
3478
+ } = _ref7;
3479
+ return xValue;
3480
+ }), max(data, _ref8 => {
3481
+ let {
3482
+ xValue
3483
+ } = _ref8;
3484
+ return xValue;
3473
3485
  })]).range(range);
3474
3486
  customXScale && customXScale(xScale);
3475
3487
  const xAxisBottom = axisBottom(xScale);
@@ -3492,35 +3504,35 @@ const draw$5 = (node, props) => {
3492
3504
  drawGridX
3493
3505
  });
3494
3506
  xAxis.attr('transform', "translate(0, " + (yScale(yTicks[0]) + (xAxisPadding || 0)) + ")");
3495
- const bubbles = svg.append('g').selectAll('dot').data(data).enter().append('circle').attr('class', bubbleChartClassNames.bubbleChartCircle).attr('cx', _ref7 => {
3507
+ const bubbles = svg.append('g').selectAll('dot').data(data).enter().append('circle').attr('class', bubbleChartClassNames.bubbleChartCircle).attr('cx', _ref9 => {
3496
3508
  let {
3497
3509
  xValue
3498
- } = _ref7;
3510
+ } = _ref9;
3499
3511
  return xScale(xValue);
3500
- }).attr('cy', _ref8 => {
3512
+ }).attr('cy', _ref10 => {
3501
3513
  let {
3502
3514
  yValue
3503
- } = _ref8;
3515
+ } = _ref10;
3504
3516
  return yScale(yValue);
3505
- }).attr('r', _ref9 => {
3517
+ }).attr('r', _ref11 => {
3506
3518
  let {
3507
3519
  sizeValue
3508
- } = _ref9;
3520
+ } = _ref11;
3509
3521
  return sizeScale(sizeValue) / 2;
3510
- }).attr('fill', _ref10 => {
3522
+ }).attr('fill', _ref12 => {
3511
3523
  let {
3512
3524
  color
3513
- } = _ref10;
3525
+ } = _ref12;
3514
3526
  return color || 'rgba(0, 176, 113, 0.6)';
3515
- }).attr('stroke', _ref11 => {
3527
+ }).attr('stroke', _ref13 => {
3516
3528
  let {
3517
3529
  stroke
3518
- } = _ref11;
3530
+ } = _ref13;
3519
3531
  return stroke || 'transparent';
3520
- }).attr('style', _ref12 => {
3532
+ }).attr('style', _ref14 => {
3521
3533
  let {
3522
3534
  style
3523
- } = _ref12;
3535
+ } = _ref14;
3524
3536
  return style || bubbleStyle || '';
3525
3537
  });
3526
3538