ng2-charts: Chart Options not editable (also legend option not working)

Updated this issue. There seems several options not being used correctly (or I’m wrong).

First of all; legend is always showing, also when adding “false”

<base-chart class="chart"
                                        [data]="[10, 20]"
                                        [labels]="['foo', 'bar']'"
                                        [legend]="false"
                                        [chartType]="doughnut">
                                </base-chart>

Second of all, I want to have a linechart with straight lines. Adding LineTension to options doesn’t work though. Were do I get wrong?

<base-chart class="chart"
                                        [datasets]="lineChartData"
                                        [labels]="lineChartLabels"
                                        [options]="lineChartOptions"
                                        [colors]="lineChartColours"
                                        [legend]="lineChartLegend"
                                        [chartType]="lineChartType">
                                    </base-chart>
// Chart values
    public lineChartData:Array<any> = [
        {data: [15, 29, 24, 21, 26, 15, 10], label: 'Opening/Time'}
    ];
    public lineChartLabels:Array<any> = ['23 mei', '24 mei', '25 mei', '26 mei', '27 mei', '28 mei', '29 mei'];
    public lineChartOptions:any = {
        animation: false,
        responsive: true,
        lineTension: 0
    };
    public lineChartColours:Array<any> = [
        { // grey
            backgroundColor: '#B3C1D9',
            borderColor: '#264E94',
            pointBackgroundColor: '#003082',
            pointBorderColor: '#fff',
            pointHoverBackgroundColor: '#fff',
            pointHoverBorderColor: 'rgba(148,159,177,0.8)'
        }
    ];
    public lineChartLegend:boolean = false;
    public lineChartType:string = 'line';

Probably this is described somewhere, but I could not find it for this plugin. Please help.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 20 (10 by maintainers)

Most upvoted comments

@alfakappa

Just this works fine for me:

line_options:any = { responsive: true, scaleShowHorizontalLines: false, scaleShowVerticalLines: false, animationEasing: "easeInOutElastic", maintainAspectRatio: false, legend: { display: false } };

I am using “chart.js”: “^2.9.4” and “ng2-charts”: “^2.4.0” but [options] doesn’t working