@evergis/react 3.1.20 → 3.1.21

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/dist/index.js CHANGED
@@ -3721,17 +3721,19 @@ const formatNumberValue = (stringFormat, value, type, noUnits = false) => {
3721
3721
  };
3722
3722
  const formatAttributeValue = ({ t, type, value, stringFormat, noUnits = false }) => {
3723
3723
  if (type === api.AttributeType.Point) {
3724
- if (!(stringFormat && stringFormat.format) || !value)
3724
+ if (!stringFormat?.format || !value)
3725
3725
  return null;
3726
3726
  const { coordinates } = value;
3727
3727
  return formatPointValue({ t, stringFormat, value: coordinates });
3728
3728
  }
3729
3729
  if (type === api.AttributeType.DateTime) {
3730
- if (!(stringFormat && stringFormat.format) || !value)
3730
+ if (!stringFormat?.format || !value)
3731
3731
  return null;
3732
3732
  return formatDateValue(stringFormat, value);
3733
3733
  }
3734
3734
  if (numberFormatTypes.includes(type) && !isNaN(value)) {
3735
+ if (!stringFormat?.format)
3736
+ return value.toString();
3735
3737
  return formatNumberValue(stringFormat, value, type, noUnits);
3736
3738
  }
3737
3739
  if (type === api.AttributeType.Json) {
@@ -9193,6 +9195,9 @@ const Chart = React.memo(({ config, element, elementConfig, type, renderElement
9193
9195
  const formatTooltipValue = React.useCallback((value, name) => isRelated
9194
9196
  ? tooltipValueFromRelatedFeatures(t, value, relatedAttributes, data[0]?.layerInfo)
9195
9197
  : tooltipValueFromAttributes(t, value, name, formattedAttributes), [data, formattedAttributes, isRelated, relatedAttributes]);
9198
+ const customYAxisLeft = React.useCallback(yAxisLeft => {
9199
+ yAxisLeft.tickFormat((index) => index);
9200
+ }, []);
9196
9201
  const customXAxisBottom = React.useCallback((xAxisBottom, data) => {
9197
9202
  xAxisBottom.tickFormat((index) => (showMarkers
9198
9203
  ? index % (showMarkers || 1) === 0
@@ -9246,12 +9251,13 @@ const Chart = React.memo(({ config, element, elementConfig, type, renderElement
9246
9251
  bottom: markers?.length ? 20 : markersMargin,
9247
9252
  left: markersMargin
9248
9253
  };
9249
- return (jsxRuntime.jsx(BarChartWrapper, { height: height + margin.bottom, children: jsxRuntime.jsx(BarChartContainer, { children: jsxRuntime.jsx(StyledBarChart, { data: barChartData, colors: getColorsFromFilterItems(data[0]?.items, defaultColor, formatFilterColor), minValue: getMinValueFromFilterItems(data[0]?.items), markers: markers, width: +width, height: height, barWidth: barWidth, barPadding: padding, className: "dashboardBarChart", customXAxisBottom: xAxisBottom => customXAxisBottom(xAxisBottom, barChartData), customYAxis: axis => !showLabels && axis.remove(), customBars: ({ bars }) => {
9254
+ return (jsxRuntime.jsx(BarChartWrapper, { height: height + margin.bottom, children: jsxRuntime.jsx(BarChartContainer, { children: jsxRuntime.jsx(StyledBarChart, { data: barChartData, colors: getColorsFromFilterItems(data[0]?.items, defaultColor, formatFilterColor), minValue: getMinValueFromFilterItems(data[0]?.items), markers: markers, width: +width, height: height, barWidth: barWidth, barPadding: padding, customYAxisLeft: customYAxisLeft, customXAxisBottom: xAxisBottom => customXAxisBottom(xAxisBottom, barChartData), customYAxis: axis => !showLabels && axis.remove(), customBars: ({ bars }) => {
9250
9255
  bars.attr("rx", radius);
9251
9256
  bars.attr("ry", radius);
9252
9257
  }, margin: margin, xAxisPadding: 0, yAxisPadding: 0, formatTooltipValue: formatTooltipValue, formatTooltipName: formatTooltipName, hideTooltipGroupName: true, dynamicTooltipEnable: true, isBarTooltip: true, onBarClick: filterName ? item => onFilter(item.name) : undefined }) }) }));
9253
9258
  }, [
9254
9259
  customXAxisBottom,
9260
+ customYAxisLeft,
9255
9261
  element,
9256
9262
  isLineChart,
9257
9263
  isStackBar,