Scatter chart with labels

Hello!

Here’s a simple scatter chart:

Link to chart

Note that the following labels are included in the data:

image

Is there a way to have each label on the points come from these labels? I.e. display Jan, Feb, etc instead of x: 2, y:4 etc.

Thanks!

Ed

Hi Ed,

Yes, this is possible using the datalabels plugin. Here’s a quick example.

This works by adding a formatter to the datalabels plugin:

        "formatter": function(value, context) {
          var idx = context.dataIndex;
          return context.chart.data.labels[idx];
        }

The formatter looks up the label according to the datapoint’s position in the dataset.

Hope this helps!

1 Like

Ian,

Amazing, thank you!

I’ve had such a great experience with QuickChart.io and your support here has been so helpful.

I don’t need the ‘Professional’ subscription, but signed up for a month anyway to support y’alls great service.

Ed

1 Like

I was able to get the callback working. Thank you Ian!

Here’s an example (ignore the formatting :joy:):


If I try to load that in the chart maker:

it seems to hang at Fetching chart config...:

Ed

Hi Ed,

This is a limitation of the Chart Maker currently. It can’t load Javascript functions that are manually created.

There’s a workaround here: enable the datalabelsZAxis plugin and set the month names as the z value on the datapoint instead of using the labels property. Here’s an example

This means your datapoints would look like this:

{
  "x": "2",
  "y": "4",
  "z": "Jan",
},
{
  "x": "3",
  "y": "3",
  "z": "Feb",
},
...

This approach should load just fine in the Chart Maker. Sorry for the trouble.

Ian

1 Like

Ian,

Amazing! Got it to work:

Banks in FR Y-9c data :

X axis: (HTM unrealized losses + AFS unrealized losses) / T1C
Y axis: (Loans secured by real estate) / total assets

I’ve divided the datasets into groups based on ‘total assets’, so that you can turn them off to reduce the overlapping.

Thank you!

Ed

1 Like

If anyone’s curious, here’s the PowerShell script I used to generate the scatter chart.

After sourcing the script, this command generates the chart:

scatter HTM_AFS_UL_T1C LSBRE_TA

Ed

1 Like