@evergis/charts 2.0.88 → 2.0.92

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.
@@ -42,6 +42,7 @@ export declare type BubbleChartProps = {
42
42
  maxYValue?: number;
43
43
  drawGridY?: boolean;
44
44
  drawGridX?: boolean;
45
+ scaleLog?: boolean;
45
46
  xScaleItemWidth?: number;
46
47
  bubbleStyle?: string;
47
48
  customize?: (props: BubbleChartCustomizeProps) => void;
@@ -3395,6 +3395,7 @@ const draw$5 = (node, props) => {
3395
3395
  maxYValue,
3396
3396
  drawGridY,
3397
3397
  drawGridX,
3398
+ scaleLog,
3398
3399
  xScaleItemWidth,
3399
3400
  bubbleStyle,
3400
3401
  customize,
@@ -3430,19 +3431,29 @@ const draw$5 = (node, props) => {
3430
3431
  return yValue;
3431
3432
  });
3432
3433
  const svg = appendSvg(node, width, height || 0);
3433
- const sizeScale = d3.scaleLinear().domain([d3.min(data, _ref3 => {
3434
+ const sizeScale = scaleLog ? d3.scaleLog().domain([d3.min(data, _ref3 => {
3434
3435
  let {
3435
3436
  sizeValue
3436
3437
  } = _ref3;
3437
3438
  return sizeValue;
3438
- }), d3.max(data, _ref4 => {
3439
+ }) || 0.1, d3.max(data, _ref4 => {
3439
3440
  let {
3440
3441
  sizeValue
3441
3442
  } = _ref4;
3442
3443
  return sizeValue;
3444
+ }) || 0.1]).range([minSize || bubbleChartDefaultProps.minSize || 0.1, maxSize || bubbleChartDefaultProps.maxSize || 0.1]) : d3.scaleLinear().domain([d3.min(data, _ref5 => {
3445
+ let {
3446
+ sizeValue
3447
+ } = _ref5;
3448
+ return sizeValue;
3449
+ }), d3.max(data, _ref6 => {
3450
+ let {
3451
+ sizeValue
3452
+ } = _ref6;
3453
+ return sizeValue;
3443
3454
  })]).range([minSize || bubbleChartDefaultProps.minSize, maxSize || bubbleChartDefaultProps.maxSize]);
3444
3455
  const yRange1 = height - marginTop - marginBottom - (xAxisPadding || 0);
3445
- const yScale = d3.scaleLinear().domain([minY, maxY]).range([yRange1, marginTop]).nice();
3456
+ const yScale = scaleLog ? d3.scaleLog().domain([minY || 0.1, maxY || 0.1]).range([yRange1 || 0.1, marginTop || 0.1]).nice() : d3.scaleLinear().domain([minY, maxY]).range([yRange1, marginTop]).nice();
3446
3457
  customYScale && customYScale(yScale);
3447
3458
  const yTicks = yScale.ticks();
3448
3459
  const yAxisLeft = d3.axisLeft(yScale).ticks(yTicksCountDefault);
@@ -3467,18 +3478,27 @@ const draw$5 = (node, props) => {
3467
3478
  const {
3468
3479
  width: yAxisWidth
3469
3480
  } = computeDimensions(yAxis);
3470
- const range = [marginLeft + yAxisWidth + (yAxisPadding || 0) + yScaleLabelHeight, width - marginRight];
3471
- const xScale = d3.scaleLinear().domain([d3.min(data, _ref5 => {
3481
+ const xScale = scaleLog ? d3.scaleLog().domain([d3.min(data, _ref7 => {
3472
3482
  let {
3473
3483
  xValue
3474
- } = _ref5;
3484
+ } = _ref7;
3475
3485
  return xValue;
3476
- }), d3.max(data, _ref6 => {
3486
+ }) || 0.1, d3.max(data, _ref8 => {
3477
3487
  let {
3478
3488
  xValue
3479
- } = _ref6;
3489
+ } = _ref8;
3490
+ return xValue;
3491
+ }) || 0.1]).range([marginLeft + yAxisWidth + (yAxisPadding || 0) + yScaleLabelHeight || 0.1, width - marginRight || 0.1]) : d3.scaleLinear().domain([d3.min(data, _ref9 => {
3492
+ let {
3493
+ xValue
3494
+ } = _ref9;
3495
+ return xValue;
3496
+ }), d3.max(data, _ref10 => {
3497
+ let {
3498
+ xValue
3499
+ } = _ref10;
3480
3500
  return xValue;
3481
- })]).range(range);
3501
+ })]).range([marginLeft + yAxisWidth + (yAxisPadding || 0) + yScaleLabelHeight, width - marginRight]);
3482
3502
  customXScale && customXScale(xScale);
3483
3503
  const xAxisBottom = d3.axisBottom(xScale);
3484
3504
 
@@ -3500,35 +3520,35 @@ const draw$5 = (node, props) => {
3500
3520
  drawGridX
3501
3521
  });
3502
3522
  xAxis.attr('transform', "translate(0, " + (yScale(yTicks[0]) + (xAxisPadding || 0)) + ")");
3503
- const bubbles = svg.append('g').selectAll('dot').data(data).enter().append('circle').attr('class', bubbleChartClassNames.bubbleChartCircle).attr('cx', _ref7 => {
3523
+ const bubbles = svg.append('g').selectAll('dot').data(data).enter().append('circle').attr('class', bubbleChartClassNames.bubbleChartCircle).attr('cx', _ref11 => {
3504
3524
  let {
3505
3525
  xValue
3506
- } = _ref7;
3526
+ } = _ref11;
3507
3527
  return xScale(xValue);
3508
- }).attr('cy', _ref8 => {
3528
+ }).attr('cy', _ref12 => {
3509
3529
  let {
3510
3530
  yValue
3511
- } = _ref8;
3531
+ } = _ref12;
3512
3532
  return yScale(yValue);
3513
- }).attr('r', _ref9 => {
3533
+ }).attr('r', _ref13 => {
3514
3534
  let {
3515
3535
  sizeValue
3516
- } = _ref9;
3536
+ } = _ref13;
3517
3537
  return sizeScale(sizeValue) / 2;
3518
- }).attr('fill', _ref10 => {
3538
+ }).attr('fill', _ref14 => {
3519
3539
  let {
3520
3540
  color
3521
- } = _ref10;
3541
+ } = _ref14;
3522
3542
  return color || 'rgba(0, 176, 113, 0.6)';
3523
- }).attr('stroke', _ref11 => {
3543
+ }).attr('stroke', _ref15 => {
3524
3544
  let {
3525
3545
  stroke
3526
- } = _ref11;
3546
+ } = _ref15;
3527
3547
  return stroke || 'transparent';
3528
- }).attr('style', _ref12 => {
3548
+ }).attr('style', _ref16 => {
3529
3549
  let {
3530
3550
  style
3531
- } = _ref12;
3551
+ } = _ref16;
3532
3552
  return style || bubbleStyle || '';
3533
3553
  });
3534
3554