diff --git a/packages/react-charting/src/components/AreaChart/__snapshots__/AreaChart.test.tsx.snap b/packages/react-charting/src/components/AreaChart/__snapshots__/AreaChart.test.tsx.snap index adc1d00ad35b35..6c1abfdb7b11a0 100644 --- a/packages/react-charting/src/components/AreaChart/__snapshots__/AreaChart.test.tsx.snap +++ b/packages/react-charting/src/components/AreaChart/__snapshots__/AreaChart.test.tsx.snap @@ -423,38 +423,32 @@ exports[`AreaChart - mouse events Should render callout correctly on mouseover 1 className= { + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; background-blend-mode: normal, luminosity; background-color: #ffffff; - display: grid; - overflow: hidden; - padding-bottom: 10px; + color: #323130; + font-family: 'Segoe UI', 'Segoe UI Web (West European)', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif; + font-size: 14px; + font-weight: 400; + padding-bottom: 16px; padding-left: 16px; padding-right: 16px; - padding-top: 11px; + padding-top: 16px; } >
-
+
-
-
- - metaData1 -
-
+ + +
- 80 -
+ { + flex-grow: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + style={ + Object { + "marginRight": "24px", + } + } + > + metaData1 +
+
+ 80
diff --git a/packages/react-charting/src/components/CommonComponents/CartesianChart.base.tsx b/packages/react-charting/src/components/CommonComponents/CartesianChart.base.tsx index dd9fd3cec62648..475fcc021e41d2 100644 --- a/packages/react-charting/src/components/CommonComponents/CartesianChart.base.tsx +++ b/packages/react-charting/src/components/CommonComponents/CartesianChart.base.tsx @@ -32,6 +32,7 @@ import { calculateLongestLabelWidth, createYAxisLabels, ChartTypes, + ChartHoverCardVariant, } from '../../utilities/index'; import { LegendShape, Shape } from '../Legends/index'; @@ -509,12 +510,11 @@ export class CartesianChartBase extends React.Component { const yValueHoverSubCountsExists: boolean = this._yValueHoverSubCountsExists(calloutProps.YValueHover); + const { updatedTime } = this.props; + return (
-
+
- {this._getCalloutContent(yValue, index, yValueHoverSubCountsExists, isLast)} -
+ +
+ {this._getCalloutContent(yValue, index, yValueHoverSubCountsExists, isLast)} +
+ {shouldDrawBorderBottom &&
} + ); })} - {!!calloutProps.descriptionMessage && ( -
{calloutProps.descriptionMessage}
- )}
+ {(!!calloutProps.descriptionMessage || !!updatedTime) &&
} + {!!calloutProps.descriptionMessage && ( +
{calloutProps.descriptionMessage}
+ )} + {!!updatedTime &&
Updated {updatedTime.toLocaleString()}
}
); }; @@ -583,46 +576,41 @@ export class CartesianChartBase extends React.Component +
{yValueHoverSubCountsExists && ( -
+
{xValue.legend!} ({yValue})
)} -
- {toDrawShape && ( - - )} -
-
{xValue.legend}
-
- {convertToLocaleString( - xValue.yAxisCalloutData ? xValue.yAxisCalloutData : xValue.y || xValue.data, - culture, - )} + {(yValueHoverSubCountsExists || calloutVariant === ChartHoverCardVariant.LongLegend) && ( +
+ {xValue.legend} +
+ )} +
+ + {!yValueHoverSubCountsExists && calloutVariant !== ChartHoverCardVariant.LongLegend && ( +
+ {xValue.legend}
+ )} +
+ {convertToLocaleString( + xValue.yAxisCalloutData ? xValue.yAxisCalloutData : xValue.y || xValue.data, + culture, + )}
@@ -630,16 +618,27 @@ export class CartesianChartBase extends React.Component -
+
+
{xValue.legend!} ({yValue})
- {Object.keys(subcounts).map((subcountName: string) => { + {Object.keys(subcounts).map((subcountName: string, idx, sc) => { return ( -
-
{convertToLocaleString(subcountName, culture)}
-
- {convertToLocaleString(subcounts[subcountName], culture)} +
+
+ {convertToLocaleString(subcountName, culture)} +
+
+ +
+ {convertToLocaleString(subcounts[subcountName], culture)} +
); diff --git a/packages/react-charting/src/components/CommonComponents/CartesianChart.styles.ts b/packages/react-charting/src/components/CommonComponents/CartesianChart.styles.ts index 783b67fb24f274..0105a3a521e852 100644 --- a/packages/react-charting/src/components/CommonComponents/CartesianChart.styles.ts +++ b/packages/react-charting/src/components/CommonComponents/CartesianChart.styles.ts @@ -1,12 +1,12 @@ import { ICartesianChartStyleProps, ICartesianChartStyles } from './CartesianChart.types'; -import { HighContrastSelectorBlack, HighContrastSelector } from '@fluentui/react/lib/Styling'; +import { HighContrastSelectorBlack, FontWeights, FontSizes } from '@fluentui/react/lib/Styling'; import { isIE11 } from '@fluentui/react'; const isIE11Var: boolean = isIE11(); export const getStyles = (props: ICartesianChartStyleProps): ICartesianChartStyles => { - const { className, theme, isRtl, shouldHighlight, href, lineColor = 'transparent', toDrawShape } = props; - const { fonts } = theme!; + const { className, theme, isRtl, shouldHighlight, href } = props; + return { root: [ theme.fonts.medium, @@ -99,85 +99,59 @@ export const getStyles = (props: ICartesianChartStyleProps): ICartesianChartStyl marginLeft: '20px', }, ], - calloutContentRoot: [ - { - display: 'grid', - overflow: 'hidden', - padding: '11px 16px 10px 16px', - backgroundColor: theme.semanticColors.bodyBackground, - backgroundBlendMode: 'normal, luminosity', - }, - ], + + calloutContentRoot: { + ...theme.fonts.medium, + color: theme.semanticColors.bodyText, + padding: '16px', + backgroundColor: theme.semanticColors.bodyBackground, + backgroundBlendMode: 'normal, luminosity', + }, + calloutDateTimeContainer: { + marginBottom: '8px', + }, + + calloutContentX: { + fontWeight: FontWeights.semibold, + }, + + calloutBlockContainer: { display: 'flex', - flexDirection: 'row', - justifyContent: 'space-between', + alignItems: 'center', }, - calloutContentX: [ - { - ...fonts.small, - lineHeight: '16px', - opacity: '0.8', - color: theme.semanticColors.bodySubtext, - }, - ], - calloutBlockContainer: [ - theme.fonts.mediumPlus, - { - marginTop: '13px', - color: theme.semanticColors.bodyText, - }, - !toDrawShape && { - selectors: { - [HighContrastSelector]: { - forcedColorAdjust: 'none', - }, - }, - borderLeft: `4px solid ${lineColor}`, - paddingLeft: '8px', - }, - toDrawShape && { - display: 'flex', - }, - ], + shapeStyles: { marginRight: '8px', + flexShrink: 0, }, + calloutlegendText: { - ...fonts.small, - lineHeight: '16px', - selectors: { - [HighContrastSelectorBlack]: { - color: 'rgb(255, 255, 255)', - }, - }, - color: theme.semanticColors.bodySubtext, + textOverflow: 'ellipsis', + overflow: 'hidden', + whiteSpace: 'nowrap', + flexGrow: 1, + }, + + calloutContentY: { + fontWeight: FontWeights.semibold, + flexShrink: 0, + }, + + divider: { + height: '1px', + backgroundColor: '#c8c8c8', + marginTop: '8px', + marginBottom: '8px', + }, + + descriptionMessage: { + fontSize: FontSizes.small, + }, + + updatedTime: { + marginTop: '8px', + fontSize: FontSizes.small, }, - calloutContentY: [ - { - ...fonts.mediumPlus, - fontWeight: 'bold', - lineHeight: '22px', - selectors: { - [HighContrastSelectorBlack]: { - color: 'rgb(255, 255, 255)', - }, - }, - }, - ], - descriptionMessage: [ - theme.fonts.small, - { - selectors: { - [HighContrastSelectorBlack]: { - color: 'rgb(255, 255, 255)', - }, - }, - color: theme.semanticColors.bodyText, - marginTop: '10px', - paddingTop: '10px', - borderTop: `1px solid ${theme.semanticColors.menuDivider}`, - }, - ], }; }; diff --git a/packages/react-charting/src/components/CommonComponents/CartesianChart.types.ts b/packages/react-charting/src/components/CommonComponents/CartesianChart.types.ts index f479a0b4b372fc..100dbafcdb4257 100644 --- a/packages/react-charting/src/components/CommonComponents/CartesianChart.types.ts +++ b/packages/react-charting/src/components/CommonComponents/CartesianChart.types.ts @@ -6,7 +6,7 @@ import { IFocusZoneProps, FocusZoneDirection } from '@fluentui/react-focus'; import { ICalloutProps } from '@fluentui/react/lib/Callout'; import { ILegendsProps } from '../Legends/index'; import { IAccessibilityProps, IMargins } from '../../types/index'; -import { ChartTypes, IChartHoverCardProps, XAxisTypes, YAxisType } from '../../utilities/index'; +import { ChartHoverCardVariant, ChartTypes, IChartHoverCardProps, XAxisTypes, YAxisType } from '../../utilities/index'; import * as d3TimeFormat from 'd3-time-format'; export interface ICartesianChartStyleProps { @@ -49,16 +49,6 @@ export interface ICartesianChartStyleProps { * prop to check if the Page is in Rtl */ isRtl?: boolean; - - /** - * color of the line - */ - lineColor?: string; - - /** - * boolean flag which determines if shape is drawn in callout - */ - toDrawShape?: boolean; } export interface ICartesianChartStyles { @@ -151,6 +141,16 @@ export interface ICartesianChartStyles { * Styles for the chart wrapper div */ chartWrapper?: IStyle; + + /** + * Styles for the group divider in callout + */ + divider?: IStyle; + + /** + * Styles for the updated time text in callout + */ + updatedTime?: IStyle; } export interface ICartesianChartProps { @@ -380,6 +380,17 @@ export interface ICartesianChartProps { * @default True for LineChart but False for other charts */ enableReflow?: boolean; + + /** + * Specifies the variant of hover card to be rendered + * @defaultvalue ChartHoverCardVariant.ShortLegend + */ + calloutVariant?: ChartHoverCardVariant; + + /** + * Time at which the chart data was last updated + */ + updatedTime?: Date; } export interface IYValueHover { diff --git a/packages/react-charting/src/components/DonutChart/__snapshots__/DonutChart.test.tsx.snap b/packages/react-charting/src/components/DonutChart/__snapshots__/DonutChart.test.tsx.snap index 790d3232b9d484..2ce9fab2900852 100644 --- a/packages/react-charting/src/components/DonutChart/__snapshots__/DonutChart.test.tsx.snap +++ b/packages/react-charting/src/components/DonutChart/__snapshots__/DonutChart.test.tsx.snap @@ -217,12 +217,19 @@ exports[`DonutChart - mouse events Should render callout correctly on mouseover className= { - font-weight: 600; margin-bottom: 8px; } > - 2020/04/30 - +
+ 2020/04/30 + +
- 2020/04/30 - +
+ 2020/04/30 + +
- 2020/04/30 - +
+ 2020/04/30 + +
{ const yValueHoverSubCountsExists: boolean = this._yValueHoverSubCountsExists(calloutProps.YValueHover); + const { updatedTime } = this.props; + return (
-
+
- {this._getCalloutContent(yValue, index, yValueHoverSubCountsExists, isLast)} -
+ +
+ {this._getCalloutContent(yValue, index, yValueHoverSubCountsExists, isLast)} +
+ {shouldDrawBorderBottom &&
} + ); })} - {!!calloutProps.descriptionMessage && ( -
{calloutProps.descriptionMessage}
- )}
+ {(!!calloutProps.descriptionMessage || !!updatedTime) &&
} + {!!calloutProps.descriptionMessage && ( +
{calloutProps.descriptionMessage}
+ )} + {!!updatedTime &&
Updated {updatedTime.toLocaleString()}
}
); }; @@ -592,42 +585,41 @@ export class GaugeChartBase extends React.Component +
{yValueHoverSubCountsExists && ( -
+
{xValue.legend!} ({yValue})
)} -
- {toDrawShape && ( - - )} -
-
{xValue.legend}
-
- {convertToLocaleString( - xValue.yAxisCalloutData ? xValue.yAxisCalloutData : xValue.y || xValue.data, - culture, - )} + {(yValueHoverSubCountsExists || calloutVariant === ChartHoverCardVariant.LongLegend) && ( +
+ {xValue.legend} +
+ )} +
+ + {!yValueHoverSubCountsExists && calloutVariant !== ChartHoverCardVariant.LongLegend && ( +
+ {xValue.legend}
+ )} +
+ {convertToLocaleString( + xValue.yAxisCalloutData ? xValue.yAxisCalloutData : xValue.y || xValue.data, + culture, + )}
@@ -635,16 +627,27 @@ export class GaugeChartBase extends React.Component -
+
+
{xValue.legend!} ({yValue})
- {Object.keys(subcounts).map((subcountName: string) => { + {Object.keys(subcounts).map((subcountName: string, idx, sc) => { return ( -
-
{convertToLocaleString(subcountName, culture)}
-
- {convertToLocaleString(subcounts[subcountName], culture)} +
+
+ {convertToLocaleString(subcountName, culture)} +
+
+ +
+ {convertToLocaleString(subcounts[subcountName], culture)} +
); diff --git a/packages/react-charting/src/components/GaugeChart/GaugeChart.styles.ts b/packages/react-charting/src/components/GaugeChart/GaugeChart.styles.ts index ccc767b32e0ab5..cc2634c10c9d2a 100644 --- a/packages/react-charting/src/components/GaugeChart/GaugeChart.styles.ts +++ b/packages/react-charting/src/components/GaugeChart/GaugeChart.styles.ts @@ -1,8 +1,8 @@ -import { FontSizes, FontWeights, HighContrastSelector, HighContrastSelectorBlack } from '@fluentui/react'; +import { FontSizes, FontWeights } from '@fluentui/react'; import { IGaugeChartStyleProps, IGaugeChartStyles } from './GaugeChart.types'; export const getStyles = (props: IGaugeChartStyleProps): IGaugeChartStyles => { - const { theme, chartValueSize, chartWidth, chartHeight, className, lineColor, toDrawShape } = props; + const { theme, chartValueSize, chartWidth, chartHeight, className } = props; return { root: [ @@ -58,85 +58,58 @@ export const getStyles = (props: IGaugeChartStyleProps): IGaugeChartStyles => { width: chartWidth, }, - calloutContentRoot: [ - { - display: 'grid', - overflow: 'hidden', - padding: '11px 16px 10px 16px', - backgroundColor: theme.semanticColors.bodyBackground, - backgroundBlendMode: 'normal, luminosity', - }, - ], + calloutContentRoot: { + ...theme.fonts.medium, + color: theme.semanticColors.bodyText, + padding: '16px', + backgroundColor: theme.semanticColors.bodyBackground, + backgroundBlendMode: 'normal, luminosity', + }, + calloutDateTimeContainer: { + marginBottom: '8px', + }, + + calloutContentX: { + fontWeight: FontWeights.semibold, + }, + + calloutBlockContainer: { display: 'flex', - flexDirection: 'row', - justifyContent: 'space-between', + alignItems: 'center', }, - calloutContentX: [ - { - ...theme.fonts.small, - lineHeight: '16px', - opacity: '0.8', - color: theme.semanticColors.bodySubtext, - }, - ], - calloutBlockContainer: [ - theme.fonts.mediumPlus, - { - marginTop: '13px', - color: theme.semanticColors.bodyText, - }, - !toDrawShape && { - selectors: { - [HighContrastSelector]: { - forcedColorAdjust: 'none', - }, - }, - borderLeft: `4px solid ${lineColor}`, - paddingLeft: '8px', - }, - toDrawShape && { - display: 'flex', - }, - ], + shapeStyles: { marginRight: '8px', + flexShrink: 0, }, + calloutlegendText: { - ...theme.fonts.small, - lineHeight: '16px', - selectors: { - [HighContrastSelectorBlack]: { - color: 'rgb(255, 255, 255)', - }, - }, - color: theme.semanticColors.bodySubtext, + textOverflow: 'ellipsis', + overflow: 'hidden', + whiteSpace: 'nowrap', + flexGrow: 1, + }, + + calloutContentY: { + fontWeight: FontWeights.semibold, + flexShrink: 0, + }, + + divider: { + height: '1px', + backgroundColor: '#c8c8c8', + marginTop: '8px', + marginBottom: '8px', + }, + + descriptionMessage: { + fontSize: FontSizes.small, + }, + + updatedTime: { + marginTop: '8px', + fontSize: FontSizes.small, }, - calloutContentY: [ - { - ...theme.fonts.mediumPlus, - fontWeight: 'bold', - lineHeight: '22px', - selectors: { - [HighContrastSelectorBlack]: { - color: 'rgb(255, 255, 255)', - }, - }, - }, - ], - descriptionMessage: [ - theme.fonts.small, - { - selectors: { - [HighContrastSelectorBlack]: { - color: 'rgb(255, 255, 255)', - }, - }, - color: theme.semanticColors.bodyText, - marginTop: '10px', - paddingTop: '10px', - borderTop: `1px solid ${theme.semanticColors.menuDivider}`, - }, - ], }; }; diff --git a/packages/react-charting/src/components/GaugeChart/GaugeChart.types.ts b/packages/react-charting/src/components/GaugeChart/GaugeChart.types.ts index 49a1456494c4f6..6c6ec4c3a37f64 100644 --- a/packages/react-charting/src/components/GaugeChart/GaugeChart.types.ts +++ b/packages/react-charting/src/components/GaugeChart/GaugeChart.types.ts @@ -3,6 +3,7 @@ import { IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities'; import { ILegendsProps } from '../Legends/index'; import { IAccessibilityProps } from '../../types/index'; import { ICalloutProps } from '@fluentui/react/lib/Callout'; +import { ChartHoverCardVariant } from '../../utilities/index'; export interface IGaugeChartSegment { /** @@ -126,6 +127,17 @@ export interface IGaugeChartProps { * Props for the callout in the chart */ calloutProps?: Partial; + + /** + * Specifies the variant of hover card to be rendered + * @defaultvalue ChartHoverCardVariant.ShortLegend + */ + calloutVariant?: ChartHoverCardVariant; + + /** + * Time at which the chart data was last updated + */ + updatedTime?: Date; } export interface IGaugeChartStyleProps { @@ -153,16 +165,6 @@ export interface IGaugeChartStyleProps { * Additional CSS class(es) to apply to the chart */ className?: string; - - /** - * Color of the line - */ - lineColor?: string; - - /** - * Boolean flag which determines if shape is drawn in callout - */ - toDrawShape?: boolean; } export interface IGaugeChartStyles { @@ -255,4 +257,14 @@ export interface IGaugeChartStyles { * Styles for the shape object in the callout */ shapeStyles?: IStyle; + + /** + * Styles for the group divider in callout + */ + divider?: IStyle; + + /** + * Styles for the updated time text in callout + */ + updatedTime?: IStyle; } diff --git a/packages/react-charting/src/components/GaugeChart/__snapshots__/GaugeChart.test.tsx.snap b/packages/react-charting/src/components/GaugeChart/__snapshots__/GaugeChart.test.tsx.snap index e460dbf1020bc2..74122d81236d6a 100644 --- a/packages/react-charting/src/components/GaugeChart/__snapshots__/GaugeChart.test.tsx.snap +++ b/packages/react-charting/src/components/GaugeChart/__snapshots__/GaugeChart.test.tsx.snap @@ -533,37 +533,32 @@ exports[`GaugeChart - event listeners testing should show a callout when the mou class= { + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; background-blend-mode: normal, luminosity; background-color: #ffffff; - display: grid; - overflow: hidden; - padding-bottom: 10px; + color: #323130; + font-family: 'Segoe UI', 'Segoe UI Web (West European)', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif; + font-size: 14px; + font-weight: 400; + padding-bottom: 16px; padding-left: 16px; padding-right: 16px; - padding-top: 11px; + padding-top: 16px; } >
-
-
- - Low Risk -
-
+ + +
- 0 - 33 -
+ { + flex-grow: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + style="margin-right: 24px;" + > + Low Risk +
+
+ 0 - 33
@@ -640,64 +628,57 @@ exports[`GaugeChart - event listeners testing should show a callout when the mou
-
-
- - Medium Risk -
-
+ + +
- 34 - 67 -
+ { + flex-grow: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + style="margin-right: 24px;" + > + Medium Risk +
+
+ 34 - 67
@@ -705,64 +686,57 @@ exports[`GaugeChart - event listeners testing should show a callout when the mou
-
-
- - High Risk -
-
+ + +
- 68 - 100 -
+ { + flex-grow: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + style="margin-right: 24px;" + > + High Risk +
+
+ 68 - 100
diff --git a/packages/react-charting/src/components/GroupedVerticalBarChart/__snapshots__/GroupedVerticalBarChart.test.tsx.snap b/packages/react-charting/src/components/GroupedVerticalBarChart/__snapshots__/GroupedVerticalBarChart.test.tsx.snap index c8f3ec7874136b..3b6b0e21e36145 100644 --- a/packages/react-charting/src/components/GroupedVerticalBarChart/__snapshots__/GroupedVerticalBarChart.test.tsx.snap +++ b/packages/react-charting/src/components/GroupedVerticalBarChart/__snapshots__/GroupedVerticalBarChart.test.tsx.snap @@ -678,11 +678,18 @@ exports[`GroupedVerticalBarChart - mouse events Should render callout correctly className= { - font-weight: 600; margin-bottom: 8px; } > - +
+ +
- Execllent (0-200) - +
+ Execllent (0-200) + +
- 2020/04/30 - +
+ 2020/04/30 + +
- 37% - +
+ 37% + +
-
+
-
-
- - metaData1 -
-
+ + +
- 50 -
+ { + flex-grow: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + style={ + Object { + "marginRight": "24px", + } + } + > + metaData1 +
+
+ 50
diff --git a/packages/react-charting/src/components/StackedBarChart/__snapshots__/MultiStackedBarChart.test.tsx.snap b/packages/react-charting/src/components/StackedBarChart/__snapshots__/MultiStackedBarChart.test.tsx.snap index 50039d7dc5ec56..4030f718e37ff2 100644 --- a/packages/react-charting/src/components/StackedBarChart/__snapshots__/MultiStackedBarChart.test.tsx.snap +++ b/packages/react-charting/src/components/StackedBarChart/__snapshots__/MultiStackedBarChart.test.tsx.snap @@ -588,12 +588,19 @@ exports[`MultiStackedBarChart - mouse events Should render callout correctly on className= { - font-weight: 600; margin-bottom: 8px; } > - 2020/04/30 - +
+ 2020/04/30 + +
- first Lorem ipsum dolor sit amet - +
+ first Lorem ipsum dolor sit amet + +
- 2020/04/30 - +
+ 2020/04/30 + +
- 2020/04/30 - +
+ 2020/04/30 + +
- 2020/04/30 - +
+ 2020/04/30 + +
-
{XValue || convertToLocaleString(Legend, culture)}
+
+
{XValue || convertToLocaleString(Legend, culture)}
+
{variant === ChartHoverCardVariant.LongLegend && !!XValue && !!Legend && (
{convertToLocaleString(Legend, culture)}
diff --git a/packages/react-charting/src/utilities/ChartHoverCard/ChartHoverCard.styles.ts b/packages/react-charting/src/utilities/ChartHoverCard/ChartHoverCard.styles.ts index 612f4022643c34..bef250b142a906 100644 --- a/packages/react-charting/src/utilities/ChartHoverCard/ChartHoverCard.styles.ts +++ b/packages/react-charting/src/utilities/ChartHoverCard/ChartHoverCard.styles.ts @@ -12,11 +12,12 @@ export const getChartHoverCardStyles = (props: IChartHoverCardStyleProps): IChar backgroundBlendMode: 'normal, luminosity', }, - calloutDateTimeContainer: {}, + calloutDateTimeContainer: { + marginBottom: '8px', + }, calloutContentX: { fontWeight: FontWeights.semibold, - marginBottom: '8px', }, calloutBlockContainer: { @@ -30,6 +31,7 @@ export const getChartHoverCardStyles = (props: IChartHoverCardStyleProps): IChar overflow: 'hidden', whiteSpace: 'nowrap', marginBottom: variant === ChartHoverCardVariant.LongLegend ? '4px' : '0px', + flexGrow: 1, }, calloutContentY: { @@ -56,6 +58,7 @@ export const getChartHoverCardStyles = (props: IChartHoverCardStyleProps): IChar calloutLegendIcon: { marginRight: '8px', + flexShrink: 0, }, divider: { diff --git a/packages/react-charting/src/utilities/ChartHoverCard/ChartHoverCard.types.ts b/packages/react-charting/src/utilities/ChartHoverCard/ChartHoverCard.types.ts index cb0f5f1bb851bf..25d7eb7b991a09 100644 --- a/packages/react-charting/src/utilities/ChartHoverCard/ChartHoverCard.types.ts +++ b/packages/react-charting/src/utilities/ChartHoverCard/ChartHoverCard.types.ts @@ -50,7 +50,7 @@ export interface IChartHoverCardProps { culture?: string; /** - * Specifies the variant of ChartHoverCard to be rendered + * Specifies the variant of hover card to be rendered * @defaultvalue ChartHoverCardVariant.ShortLegend */ variant?: ChartHoverCardVariant; @@ -112,13 +112,19 @@ export interface IChartHoverCardStyles { */ descriptionMessage?: IStyle; - /** styles for the legend icon */ + /** + * styles for the legend icon + */ calloutLegendIcon?: IStyle; - /** styles for the group divider */ + /** + * styles for the group divider + */ divider?: IStyle; - /** styles for the updated time text */ + /** + * styles for the updated time text + */ updatedTime?: IStyle; } diff --git a/packages/react-examples/src/react-charting/AreaChart/AreaChart.Multiple.Example.tsx b/packages/react-examples/src/react-charting/AreaChart/AreaChart.Multiple.Example.tsx index 4e816dc6308bcc..811160b8633ba1 100644 --- a/packages/react-examples/src/react-charting/AreaChart/AreaChart.Multiple.Example.tsx +++ b/packages/react-examples/src/react-charting/AreaChart/AreaChart.Multiple.Example.tsx @@ -33,42 +33,52 @@ export class AreaChartMultipleExample extends React.Component<{}, IAreaChartBasi { x: 20, y: 9, + yAxisCalloutData: { 'Subcount1-1': 2, 'Subcount1-2': 3, 'Subcount1-3': 4 }, }, { x: 25, y: 14, + yAxisCalloutData: { 'Subcount1-1': 3, 'Subcount1-2': 5, 'Subcount1-3': 6 }, }, { x: 30, y: 14, + yAxisCalloutData: { 'Subcount1-1': 3, 'Subcount1-2': 5, 'Subcount1-3': 6 }, }, { x: 35, y: 23, + yAxisCalloutData: { 'Subcount1-1': 6, 'Subcount1-2': 8, 'Subcount1-3': 9 }, }, { x: 40, y: 20, + yAxisCalloutData: { 'Subcount1-1': 5, 'Subcount1-2': 7, 'Subcount1-3': 8 }, }, { x: 45, y: 31, + yAxisCalloutData: { 'Subcount1-1': 9, 'Subcount1-2': 10, 'Subcount1-3': 12 }, }, { x: 50, y: 29, + yAxisCalloutData: { 'Subcount1-1': 8, 'Subcount1-2': 10, 'Subcount1-3': 11 }, }, { x: 55, y: 27, + yAxisCalloutData: { 'Subcount1-1': 8, 'Subcount1-2': 9, 'Subcount1-3': 10 }, }, { x: 60, y: 37, + yAxisCalloutData: { 'Subcount1-1': 11, 'Subcount1-2': 12, 'Subcount1-3': 14 }, }, { x: 65, y: 51, + yAxisCalloutData: { 'Subcount1-1': 16, 'Subcount1-2': 17, 'Subcount1-3': 18 }, }, ]; @@ -76,42 +86,52 @@ export class AreaChartMultipleExample extends React.Component<{}, IAreaChartBasi { x: 20, y: 21, + yAxisCalloutData: { 'Subcount2-1': 6, 'Subcount2-2': 7, 'Subcount2-3': 8 }, }, { x: 25, y: 25, + yAxisCalloutData: { 'Subcount2-1': 7, 'Subcount2-2': 8, 'Subcount2-3': 10 }, }, { x: 30, y: 10, + yAxisCalloutData: { 'Subcount2-1': 2, 'Subcount2-2': 3, 'Subcount2-3': 5 }, }, { x: 35, y: 10, + yAxisCalloutData: { 'Subcount2-1': 2, 'Subcount2-2': 3, 'Subcount2-3': 5 }, }, { x: 40, y: 14, + yAxisCalloutData: { 'Subcount2-1': 3, 'Subcount2-2': 5, 'Subcount2-3': 6 }, }, { x: 45, y: 18, + yAxisCalloutData: { 'Subcount2-1': 5, 'Subcount2-2': 6, 'Subcount2-3': 7 }, }, { x: 50, y: 9, + yAxisCalloutData: { 'Subcount2-1': 2, 'Subcount2-2': 3, 'Subcount2-3': 4 }, }, { x: 55, y: 23, + yAxisCalloutData: { 'Subcount2-1': 6, 'Subcount2-2': 8, 'Subcount2-3': 9 }, }, { x: 60, y: 7, + yAxisCalloutData: { 'Subcount2-1': 1, 'Subcount2-2': 2, 'Subcount2-3': 4 }, }, { x: 65, y: 55, + yAxisCalloutData: { 'Subcount2-1': 17, 'Subcount2-2': 18, 'Subcount2-3': 20 }, }, ]; @@ -119,42 +139,52 @@ export class AreaChartMultipleExample extends React.Component<{}, IAreaChartBasi { x: 20, y: 30, + yAxisCalloutData: { 'Subcount3-1': 9, 'Subcount3-2': 10, 'Subcount3-3': 11 }, }, { x: 25, y: 35, + yAxisCalloutData: { 'Subcount3-1': 10, 'Subcount3-2': 12, 'Subcount3-3': 13 }, }, { x: 30, y: 33, + yAxisCalloutData: { 'Subcount3-1': 10, 'Subcount3-2': 11, 'Subcount3-3': 12 }, }, { x: 35, y: 40, + yAxisCalloutData: { 'Subcount3-1': 12, 'Subcount3-2': 13, 'Subcount3-3': 15 }, }, { x: 40, y: 10, + yAxisCalloutData: { 'Subcount3-1': 2, 'Subcount3-2': 3, 'Subcount3-3': 5 }, }, { x: 45, y: 40, + yAxisCalloutData: { 'Subcount3-1': 12, 'Subcount3-2': 13, 'Subcount3-3': 15 }, }, { x: 50, y: 34, + yAxisCalloutData: { 'Subcount3-1': 10, 'Subcount3-2': 11, 'Subcount3-3': 13 }, }, { x: 55, y: 40, + yAxisCalloutData: { ['Subcount3-1']: 12, 'Subcount3-2': 13, 'Subcount3-3': 15 }, }, { x: 60, y: 60, + yAxisCalloutData: { 'Subcount3-1': 19, 'Subcount3-2': 20, 'Subcount3-3': 21 }, }, { x: 65, y: 40, + yAxisCalloutData: { 'Subcount3-1': 12, 'Subcount3-2': 13, 'Subcount3-3': 15 }, }, ];