angular2-highcharts icon indicating copy to clipboard operation
angular2-highcharts copied to clipboard

how to change the chart title

Open qasimraza1979 opened this issue 8 years ago • 1 comments

I am using angular 4 in my case and have following html

  <chart type="StockChart" [options]="options" >
    <series  (mouseOver)="onSeriesMouseOver($event)"></series>
  </chart>

and in chart.component.ts

import { Component } from '@angular/core';

@Component({
	selector: 'lineChart',
	templateUrl: './lineChart.component.html'
})
export class LineChartComponent {
	private config: any;
	private title: string;
	private series: Object;	
	private options: any;
	private highStockComponent: any;

	constructor() {
		this.title = "simple chart";

        this.options = {
            title : { text : this.title },
            series: [{
                data: [29.9, 71.5, 106.4, 129.2,124],
            }]
        };
		this.highStockComponent = this;
    }

	onSeriesMouseOver(e){
	}
	changeTitle(){
		this.title = "changed simple chart";	
		this.highStockComponent.chart.redraw;			
	}
}

on the click of button, I want to change the chart title. What mistake I am making as it is giving me following error. when I click the button.

image

Similarly I want to update chart if any of series data gets updated.

Anxiously waiting for the reply.

qasimraza1979 avatar Jun 14 '17 10:06 qasimraza1979

@qasimraza1979 you need to call update(options: ChartOptions, redraw?: boolean) method of the chartObject following this instead of the chart.redraw.

attilacsanyi avatar Jun 20 '17 10:06 attilacsanyi