Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
createScrollBarsAndLegend(scrollbarX = true, scrollbarY = false, legend = true, cursor = true) {
if (scrollbarX) {
this.chart.scrollbarX = new am4charts.XYChartScrollbar();
this.chart.scrollbarX.parent = this.chart.bottomAxesContainer;
}
if (scrollbarY) {
this.chart.scrollbarY = new am4core.Scrollbar();
this.chart.scrollbarY.parent = this.chart.leftAxesContainer;
}
if (legend) {
this.chart.legend = new am4charts.Legend();
}
if (cursor) {
this.chart.cursor = new am4charts.XYCursor();
this.chart.cursor.behavior = "panXY";
}
}
createScrollBarsAndLegend(scrollbarX = true, scrollbarY = false, legend = true, cursor = true) {
if (scrollbarX) {
this.chart.scrollbarX = new am4charts.XYChartScrollbar();
this.chart.scrollbarX.parent = this.chart.bottomAxesContainer;
}
if (scrollbarY) {
this.chart.scrollbarY = new am4core.Scrollbar();
this.chart.scrollbarY.parent = this.chart.leftAxesContainer;
}
if (legend) {
this.chart.legend = new am4charts.Legend();
}
if (cursor) {
this.chart.cursor = new am4charts.XYCursor();
this.chart.cursor.behavior = "panXY";
}
}
dateAxis.renderer.grid.template.location = 0;
let valueAxis = chart.yAxes.push(new am4charts.DurationAxis());
valueAxis.tooltip.disabled = true;
valueAxis.renderer.minWidth = 35;
valueAxis.baseUnit = "second";
let series = chart.series.push(new am4charts.StepLineSeries());
series.dataFields.dateX = "date";
series.dataFields.valueY = "seconds";
series.tooltipText = "{valueY.formatDuration()}";
series.fillOpacity = 0.3;
chart.cursor = new am4charts.XYCursor();
let scrollbarX = new am4charts.XYChartScrollbar();
scrollbarX.series.push(series);
chart.scrollbarX = scrollbarX;
dateAxis.renderer.grid.template.location = 0;
const valueAxis = chart.yAxes.push(new am4charts.ValueAxis() as any);
if (valueAxis.tooltip) {
valueAxis.tooltip.disabled = true;
}
valueAxis.renderer.minWidth = 35;
const series = chart.series.push(new am4charts.LineSeries() as any);
series.dataFields.dateX = 'date';
series.dataFields.valueY = 'value';
series.tooltipText = '{valueY.value}';
chart.cursor = new am4charts.XYCursor() as any;
const scrollbarX = new am4charts.XYChartScrollbar();
scrollbarX.series.push(series);
chart.scrollbarX = scrollbarX as any;
}
/**
* MAP
*/
if (tsChartMapTypeCheck(chart)) {
const polygonSeries = new am4maps.MapPolygonSeries();
polygonSeries.useGeodata = true;
polygonSeries.include = [
'PT',
'ES',
'FR',
'DE',
'BE',
valueAxis2.renderer.fontSize = "0.8em"
valueAxis2.renderer.gridContainer.background.fill = am4core.color("#000000");
valueAxis2.renderer.gridContainer.background.fillOpacity = 0.05;
let series2 = chart.series.push(new am4charts.ColumnSeries());
series2.dataFields.dateX = "date";
series2.dataFields.valueY = "quantity";
series2.yAxis = valueAxis2;
series2.tooltipText = "{valueY.value}";
series2.name = "Series 2";
chart.cursor = new am4charts.XYCursor();
chart.cursor.xAxis = dateAxis;
let scrollbarX = new am4charts.XYChartScrollbar();
scrollbarX.series.push(series);
scrollbarX.marginBottom = 20;
chart.scrollbarX = scrollbarX;
let dateAxis = chart.xAxes.push(new am4charts.DateAxis());
dateAxis.renderer.grid.template.location = 0;
let valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
valueAxis.tooltip.disabled = true;
valueAxis.renderer.minWidth = 35;
let series = chart.series.push(new am4charts.LineSeries());
series.dataFields.dateX = "date";
series.dataFields.valueY = "value";
series.tooltipText = "{valueY.value}";
chart.cursor = new am4charts.XYCursor();
let scrollbarX = new am4charts.XYChartScrollbar();
scrollbarX.series.push(series);
chart.scrollbarX = scrollbarX;
this.chart = chart;
});
}