1

I have a bar chart and I want to draw an average line on this bar chart.

My solution:

In data sets, I add an element with type as 'line':

https://stackblitz.com/edit/ng2-charts-bar-template?file=src%2Fapp%2Fapp.component.ts

public barChartLabels: Label[] = ['2006', '2007', '2008', '2009', '2010', '2011', '2012'];
public barChartType: ChartType = 'bar';
public barChartLegend = true;
public barChartPlugins = [];

public barChartData: ChartDataSets[] = 
[
{ data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A' },
{ data: [28, 48, 40, 19, 86, 27, 90], label: 'Series B' },
**{ data: [48, 48, 48, 48, 48, 48, 48], label: 'Series C', type: '*line*' }**
];

The line does not start at the beginning of the y-axis, it is not connected to that y-axis. (I understand because it's in the bar chart) enter image description here

However, I still want it to be displayed as below, it will be started at the beginning of the y-axis: enter image description here

=> My desired results: enter image description here

Akber Iqbal
  • 14,487
  • 12
  • 48
  • 70
Minh Tien Tran
  • 1,038
  • 9
  • 11
  • 2
    Possible duplicate of [How can I get multiple charts(bar and line) with ng2-charts?](https://stackoverflow.com/questions/57886007/how-can-i-get-multiple-chartsbar-and-line-with-ng2-charts) – Abu Taha Sep 11 '19 at 09:53
  • @Abu taha It is a link to the same question which was asked by the OP for which he did not got an answer from the community. – shuberman Sep 11 '19 at 09:57

0 Answers0