Pass locale to chart rendering library

This commit is contained in:
Przemek Wiech 2019-02-14 22:40:08 +01:00
parent 0d621c045b
commit 631f8814a9
2 changed files with 8 additions and 1 deletions

View File

@ -16,7 +16,7 @@
"semantic-ui-css": "^2.4.1",
"semantic-ui-react": "^0.84.0",
"string.prototype.startswith": "^0.2.0",
"topola": "2.x"
"topola": "^2.2"
},
"devDependencies": {
"@types/d3": "^5.5.0",

View File

@ -1,5 +1,6 @@
import * as d3 from 'd3';
import * as React from 'react';
import {intlShape} from 'react-intl';
import {
JsonGedcomData,
ChartHandle,
@ -52,6 +53,7 @@ export class Chart extends React.PureComponent<ChartProps, {}> {
indiCallback: (info) => this.props.onSelection(info),
animate: true,
updateSvgSize: false,
locale: this.context.intl.locale,
});
}
const chartInfo = this.chart!.render({
@ -119,6 +121,11 @@ export class Chart extends React.PureComponent<ChartProps, {}> {
this.renderChart({initialRender: this.props.data !== prevProps.data});
}
/** Make intl appear in this.context. */
static contextTypes = {
intl: intlShape,
};
render() {
return (
<div id="svgContainer">