Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidMount() {
const { id, isMobile } = this.props;
noData(Highcharts);
Highcharts.setOptions({
lang: {
thousandsSep: ","
}
});
const containerId = "profit_loss_chart_container" + id;
const chartId = "profit_loss_chart" + id;
// calculate horizontal margins, if mobile 0, else default
const horizontalMargins = isMobile ? 0 : null;
// determine height based on mobile or not
let height = isMobile ? 260 : 170;
// if the width of container is going to be <= height use 9/16 aspect ratio
if (this.refs[containerId].clientWidth <= height) {
height = (9 / 16) * 100 + "%";
}
window.highchartsGlobalOptions = ((): void => {
setOptions(DT_CHART_DEFAULT_GLOBAL_OPTIONS);
})();
// Highcharts global options, set outside component so its not set every time a chart is created
window.highchartsGlobalOptions = ((): void => {
setOptions(DT_CHART_DEFAULT_GLOBAL_OPTIONS);
})();
// Highcharts global options, set outside component so its not set every time a chart is created
subtitle: {
style: {
display: 'block',
right: 0,
// width: '100%; !important',
marginBottom: '20px',
fontSize: '12px',
lineHeight: 1.5,
fontWeight: 300,
color: '#596371',
},
}
/*eslint-enable */
};
Highcharts.setOptions({
...THEME
});
const withHighcharts = Composed => {
return class extends Component {
constructor(props) {
super(props);
this.create = this.create.bind(this);
this.redraw = this.redraw.bind(this);
this.destroy = this.destroy.bind(this);
this._instance = null;
}
shouldComponentUpdate(nextProps, nextState) {
private setHighchartTheme() {
const currentOptions = Highcharts.getOptions();
for (const property in currentOptions) {
if (typeof currentOptions[property] !== 'function') {
delete currentOptions[property]
}
}
Highcharts.setOptions(this.defaultHighchartsTheme);
Highcharts.setOptions(this.theme.highcharts as any);
}
chartSetup(callback = () => {}) {
window.removeEventListener("resize", this.updateChartDebounced);
Highcharts.setOptions({
lang: {
thousandsSep: ","
}
});
const id = "performance_graph_chart";
this.performanceGraph = new Highcharts.Chart(id, {
title: {
text: null
},
chart: {
backgroundColor: "transparent",
height: "220px",
spacingLeft: 0,
spacingRight: 0
},
export function HighchartsFactory() {
Highcharts.setOptions({
colors: ['#39f', '#ccc']
});
return Highcharts;
}