'Title is getting truncated in Horizontal Bar chart
I am trying to show the bar labels in a horizontal bar chart but as you have seen in the below image the width is small and because of this the title is truncated from starting and I am not able to identify how can I resolve this. As of now, from starting of the name it is truncated, the solution is to truncate it from last and show (…) at the end & provide a tooltip when users hover over the values for clear visibility but the problem remains the same for me.
if(this.barWidget.getValue().orientation===Orientation.HORIZONTAL){
this.barChartOptions.scales={
xAxes: [
{
scaleLabel: {
display: true,
labelString: this.barWidget.getValue().xAxisLabel?this.barWidget.getValue().xAxisLabel: ''
},
ticks: {
padding: this.barWidget.getValue().isEnableDatalabels&&(this.barWidget.getValue().datalabelsPosition==='start'||this.barWidget.getValue().datalabelsPosition==='center')?20: 0
}
}
],
yAxes: [
{
scaleLabel: {
display: true,
labelString: this.barWidget.getValue().yAxisLabel?this.barWidget.getValue().yAxisLabel: ''
},
ticks: {
callback: (value,
index,
values)=>{
return(value.valueOf().toString().length>this.labelTooltipCharLimit)?value.toString().slice(0,
this.labelTooltipCharLimit)+'...': value;
},
padding: this.barWidget.getValue().isEnableDatalabels&&(this.barWidget.getValue().orientation===Orientation.HORIZONTAL)&&(this.barWidget.getValue().datalabelsPosition==='start'||this.barWidget.getValue().datalabelsPosition==='center')?40: 0
}
}
],
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
