diff --git a/src/components/BarChartCard/BarChartCard.jsx b/src/components/BarChartCard/BarChartCard.jsx index d927270a7a..66a330d117 100644 --- a/src/components/BarChartCard/BarChartCard.jsx +++ b/src/components/BarChartCard/BarChartCard.jsx @@ -282,6 +282,8 @@ const BarChartCard = ({ showTimeInGMT, tooltipDateFormatPattern ), + groupLabel: i18n.tooltipGroupLabel, + totalLabel: i18n.tooltipTotalLabel, }, // zoomBar should only be enabled for time-based charts ...(zoomBar?.enabled && @@ -353,6 +355,8 @@ BarChartCard.defaultProps = { size: CARD_SIZES.MEDIUMWIDE, i18n: { noDataLabel: 'No data', + tooltipGroupLabel: 'Group', + tooltipTotalLabel: 'Total', }, domainRange: null, content: { diff --git a/src/components/BarChartCard/BarChartCard.story.jsx b/src/components/BarChartCard/BarChartCard.story.jsx index ca93af5c11..340fd88ceb 100644 --- a/src/components/BarChartCard/BarChartCard.story.jsx +++ b/src/components/BarChartCard/BarChartCard.story.jsx @@ -20,7 +20,6 @@ const acceptableSizes = Object.keys(CARD_SIZES).filter( export default { title: 'Watson IoT/BarChartCard', - parameters: { component: BarChartCard, }, diff --git a/src/components/BarChartCard/barChartUtils.js b/src/components/BarChartCard/barChartUtils.js index 796b9e04e9..1917a3826b 100644 --- a/src/components/BarChartCard/barChartUtils.js +++ b/src/components/BarChartCard/barChartUtils.js @@ -438,7 +438,6 @@ export const formatColors = ( /** * Extends default tooltip with additional date information if the graph is time-based - * and adds color of dataset if defined * * This function is a bit more hacky than TimeSeriesCard because carbon charts formats it differently * TODO: remove the hackiness once this issue is solved: https://github.com/carbon-design-system/carbon-charts/issues/657 diff --git a/src/components/TimeSeriesCard/TimeSeriesCard.jsx b/src/components/TimeSeriesCard/TimeSeriesCard.jsx index 02505d909b..c07826b791 100644 --- a/src/components/TimeSeriesCard/TimeSeriesCard.jsx +++ b/src/components/TimeSeriesCard/TimeSeriesCard.jsx @@ -89,6 +89,7 @@ const TimeSeriesCardPropTypes = { i18n: PropTypes.shape({ alertDetected: PropTypes.string, noData: PropTypes.string, + tooltipGroupLabel: PropTypes.string, }), /** array of data from the backend for instance [{timestamp: Date object || ms timestamp, temperature: 35, humidity: 10}, ...] */ values: PropTypes.arrayOf( @@ -599,6 +600,7 @@ const TimeSeriesCard = ({ showTimeInGMT, tooltipDateFormatPattern ), + groupLabel: i18n.tooltipGroupLabel, }, getStrokeColor: handleStrokeColor, getFillColor: handleFillColor, @@ -680,6 +682,7 @@ TimeSeriesCard.defaultProps = { i18n: { alertDetected: 'Alert detected:', noDataLabel: 'No data is available for this time range.', + tooltipGroupLabel: 'Group', }, chartType: TIME_SERIES_TYPES.LINE, locale: 'en', diff --git a/src/components/TimeSeriesCard/TimeSeriesCard.story.jsx b/src/components/TimeSeriesCard/TimeSeriesCard.story.jsx index cd07f42ef2..7706ec4bf0 100644 --- a/src/components/TimeSeriesCard/TimeSeriesCard.story.jsx +++ b/src/components/TimeSeriesCard/TimeSeriesCard.story.jsx @@ -16,7 +16,6 @@ const commonProps = { export default { title: 'Watson IoT/TimeSeriesCard', - parameters: { component: TimeSeriesCard, }, @@ -1331,6 +1330,9 @@ export const Locale = () => { showTimeInGMT={boolean('showTimeInGMT', false)} size={size} onCardAction={action('onCardAction')} + i18n={{ + tooltipGroupLabel: 'Translated Group', + }} /> ); diff --git a/src/constants/CardPropTypes.js b/src/constants/CardPropTypes.js index e30d5ee2ec..4ac7df9ba3 100644 --- a/src/constants/CardPropTypes.js +++ b/src/constants/CardPropTypes.js @@ -368,6 +368,8 @@ export const BarChartCardPropTypes = { /** internationalization */ i18n: PropTypes.shape({ alertDetected: PropTypes.string, + tooltipGroupLabel: PropTypes.string, + tooltipTotalLabel: PropTypes.string, }), /** optional domain to graph from. First value is the beginning of the range. Second value is the end of the range * can be date instance or timestamp */ diff --git a/src/utils/__tests__/__snapshots__/publicAPI.test.js.snap b/src/utils/__tests__/__snapshots__/publicAPI.test.js.snap index ced3ae2d7e..f53bb8ea8c 100644 --- a/src/utils/__tests__/__snapshots__/publicAPI.test.js.snap +++ b/src/utils/__tests__/__snapshots__/publicAPI.test.js.snap @@ -4510,6 +4510,8 @@ Map { "domainRange": null, "i18n": Object { "noDataLabel": "No data", + "tooltipGroupLabel": "Group", + "tooltipTotalLabel": "Total", }, "locale": "en", "showTimeInGMT": false, @@ -5158,6 +5160,12 @@ Map { "alertDetected": Object { "type": "string", }, + "tooltipGroupLabel": Object { + "type": "string", + }, + "tooltipTotalLabel": Object { + "type": "string", + }, }, ], "type": "shape", @@ -12191,6 +12199,7 @@ Map { "i18n": Object { "alertDetected": "Alert detected:", "noDataLabel": "No data is available for this time range.", + "tooltipGroupLabel": "Group", }, "locale": "en", "showTimeInGMT": false, @@ -12889,6 +12898,9 @@ Map { "noData": Object { "type": "string", }, + "tooltipGroupLabel": Object { + "type": "string", + }, }, ], "type": "shape",