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