Tooltip For Loop

1 Answer 44 Views
Charts Tooltip
Travis
Top achievements
Rank 1
Iron
Travis asked on 04 May 2021, 02:57 PM

I am trying to display a property from each looped through item but it only displays the last value of the item for all of the tooltips displayed.

I am trying to display each item's line name

lines =

export class Line {
  linenumbernumber = 0;
  linenamestring = '';
  completionpercentagesCompletion[] = [];
}

 

and I am trying to access the linename attribute

 

 <kendo-chart-series-item
      *ngFor="let item of this.ourdata.lines"
      type="bar"
      [data]="this.item.completionpercentages"
      [name]="this.item.linename"
      field="hours"
      axis="laborhours"
    >
      <kendo-chart-tooltip>
        <ng-template
          kendoChartSeriesTooltipTemplate
          let-value="value"
          let-category="category"
          let-dataItem="dataItem"
        >
          {{ intl.formatNumber(dataItem.completion"##.0") }}% <br />{{
            dataItem.historydate | date"shortDate"
          }}
          <br />Line: {{ dataItem.linenumber }} - {{ this.item.linename}} ---
          <br />Labor: {{ dataItem.hours }} Hours
        </ng-template>
      </kendo-chart-tooltip>
    

</kendo-chart-series-item>

 

In the tooltip the dataItem is the completion object which doesn't have the attribute linename.

 

For each of the tooltips it displays the last item's line name in each without displaying their own..

 

in this case line 7 should be "Bulk Areas"

1 Answer, 1 is accepted

Sort by
0
Accepted
Travis
Top achievements
Rank 1
Iron
answered on 05 May 2021, 03:54 PM
Issues has been resolved. It was the linename not coming through properly from the back-end
Tags
Charts Tooltip
Asked by
Travis
Top achievements
Rank 1
Iron
Answers by
Travis
Top achievements
Rank 1
Iron
Share this question
or