Chart element class names and CSS

Type tutorial

amCharts 4 allows automatically adding element-specific class attributes to its SVG elements for easy targeting via CSS selectors. This tutorial explains how to enable and use them. Enabling class names By default, when chart is generating SVG elements, no class attributes are added to it’s element. Let’s take a simple Line series with bullets: The […]

Modifying big number prefixes

Type tutorial

amCharts’ number formatter has a way of formatting numbers in a variety of ways, including converting to prefix/suffix-based shorter equivalents. This tutorial will explain how you can tweak it according to your needs. The problem Extremely big numbers on a chart can be confusing and wasteful of space: Let’s see how we can fix that. […]

Truncating legend labels

Type tutorial

Sometimes chart legend can get out of control size-wise, especially if you have long labels. This tutorial will show how you can get it back in check by capping the length of its labels. The problem Long labels will bloat up legend size. This is especially prominent where chart size is not very big: Even […]

Lazy loading amCharts modules

Type tutorial

It is possible to load the amCharts library only when needed. This tutorial will explain how. The import() expression is the official way to lazy load any ES6 module, including amCharts. However, import() can only import a single module, so you have to combine it with Promise.all to load multiple modules. Here is how to […]

Curved Pie Chart Labels

Type tutorial

Normally, labels for Pie chart’s slices are horizontal, and either arranged in columns or attached to the slice itself. This tutorial will show how you can make labels curve along the outer edge of the slice. Base chart Let’s take a super basic pie chart as our starting point. Making labels cool again To make […]

Using curved labels

Type tutorial

In amCharts 4 any SVG label can follow any curve. This tutorial will explain how it works and how you can spice up the look of your charts in various situations, using curved labels. The basics All text labels in amCharts 4 are represented by an object of type Label. To make a label follow […]

Styling or removing tooltip shadow

Type tutorial

Most of the elements on charts can display a tooltip when hovered. By default, a tooltip will cast a slight shadow behind it. This tutorial will explain on how to style it, or get rid of it altogether. Accessing tooltip Before we can start, let’s see how we can access the tooltip, that is Tooltip […]

Removing chart background on print

Type tutorial

Your on-screen designs might call for a chart background. However, when printed, those will wasted a lot of ink. This tutorial will explain how to disable chart’s background when using Export’s Print option. The problem Let’s use a chart with a nice gradient as a background. Now, when we try to print it, the background […]

Hiding Small Pie Slices

Type tutorial

Pie chart sizes its slices proportionally, based on the relative values. Sometimes that means that we end up with a chart that has a bunch of small-value slices that are barely visible, but clutter up the chart. Here’s one chart like that: Ewww. Let’s see what we can do about it. Hiding labels Let’s hide […]

Variable-radius Pie Slices

Type tutorial

This short tutorial will explain how you can create a Pie chart that uses data to vary radius of individual slices. Base chart Let’s take this simple Pie chart as a basis for our further experiments. Introducing radius value Right now, the size of each slice represents a value and its relation to other values […]