dynamically change the Coverage percentage value in a pie chart

Options
Matt_Darwin
edited February 11, 2022 in Analytics #1

Hi,

I have a use case to try change a Pie chart's 'Coverage' percentage value dynamically.
i.e. based on certain conditions, change the value say from 80% to 60%.

I figure this could possibly be done within the chart onRender scripting, but am unsure how to apply it?

Can anyone please point me in the right direction? :)

Thanks,
Matt

Answers

  • jfranken
    Options

    On the chart editor's Select Data tab, try placing your code in the expression for the series (the box beneath "Series 1"). For example, if you are charting Sales by Country and have data for both in the chart, you will see the following expression for the Y series:

    row["Sales"]

    It will chart the Sales data. You can add JavaScript like this to double the Sales for the UK:

    if (row["Country"] == "UK") {
    row["Sales"] * 2
    } else {
    row["Sales"]
    }

    (note: This code is not tested and is only meant for instructional purposes.)

    Warning No formatter is installed for the format ipb