mirror of
https://github.com/PeWu/topola-viewer.git
synced 2025-12-23 18:50:04 +00:00
Pass locale to chart rendering library
This commit is contained in:
parent
0d621c045b
commit
631f8814a9
@ -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",
|
||||
|
||||
@ -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">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user