Chart label reposition dynamically

Vignesh Babu Sundararajan 46 Reputation points
2022-06-15T03:35:08.367+00:00

function main(workbook: ExcelScript.Workbook
) {
let selectedSheet = workbook.getWorksheet("Sheet1");
//get the current used range and lastRow
let myUsedRange = selectedSheet.getUsedRange();
let lastRow = myUsedRange.getAddress();
let radarchart = selectedSheet.addChart(ExcelScript.ChartType.radarFilled, selectedSheet.getRange(lastRow));
radarchart.getSeriesNameLevel[0]
radarchart.getTitle().setText('Score by Section')
radarchart.getAxes().getValueAxis().getFormat().getFont().setSize(1)
radarchart.getDataLabels().setShowValue(true);
let radarchartimage = radarchart.getImage()
radarchart.delete();
return [radarchartimage]
}

211494-chart.png

@Yutao Huang - MSFT
The Chart values are overlapping chart labels .
How to reposition them dynamically so that it does not overlap

Microsoft 365 and Office | Excel | For business | Windows
{count} votes

Answer accepted by question author
  1. Yutao Huang - MSFT 701 Reputation points Microsoft Employee
    2022-06-15T15:46:30.697+00:00

    @Vignesh Babu Sundararajan

    This seems like a radar chart rendering issue. I'd suggest submitting a frown through the feedback button in Excel Online.

    211699-image.png

    As a temporary workaround, maybe you can consider somehow concatenating the operation name and the score into a single column to be used as the "Category Labels", then hide the data labels (radarchart.getDataLabels().setShowValue(false)). Something like this (I used the sample data from another post of yours :) ):

    211791-image.png

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Vignesh Babu Sundararajan 46 Reputation points
    2022-06-15T16:27:57.993+00:00

    Great Thanks

    I did the same work around !

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.