-1

I'm trying to display ng charts in an extended child row Datatable but it is not displayed

Chart is not display

function to add child

addChildTable(rowInstance, index: string) {
    const tr = $('#' + index);
    const row = this.table.row(rowInstance);
    const data = this.table.row(rowInstance).data();
    
    if (row.child.isShown()) {
        // This row is already open - close it
        row.child.hide();
        tr.removeClass('shown');


    } else {
        const childTable = this.getRowDetails();

        row.child(childTable).show();
        tr.addClass('shown');

    }
  }

this is my function that return ng-chart in component .ts but unfortunately return empty view

  getRowDetails() {

    return ` <div class="row">

                            <div class="card-body"  >

                            <canvas baseChart
                                [datasets]="` + this.lineChartData + `"
                                [labels]="` + this.lineChartLabels + `"
                                [options]="` + this.lineChartOptions + `"
                                [colors]="` + this.lineChartColors + `"
                                [legend]="` + this.lineChartLegend + `"
                                [chartType]="` + this.lineChartType + `"
                                [plugins]="` + this.lineChartPlugins + `">
                            </canvas>
                                        </div>
                                    </div>
                            </div>

</div>`;
}
Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
ABM
  • 17
  • 6

1 Answers1

0

Hi I think you should use a specific ID for every chart because with a fixed ID you can not display more than one chart on the same page.

  • Hi I have tried this solution specific id for each schema but it gives me the same result (empty view) – ABM Oct 02 '21 at 11:38