Datapicta logo
© 2025 DataPicta
Working with formulas

Sometimes you want to create a chart where the look and feel of the marks depends on the values of the data. For intance, you want to create a bar chart where the color of the bars are green if the value is positive and red if the value is negative.

In DataPicta you can do this by using formulas, in this article we will show you how to do this. We will create a vertical bar chart with positive and negative values. The positive values will be green and the negative values will be red. But we will also use several text marks and image marks that will be placed left or right from the bars, depending on the data.

Introducing the dataset

In this example we will use the dataset of the population of the 27 EU countries. We will use the population of these countries in 2004 and in 2024 and will look at the differences. Some countries have an increasing population, some have a decreasing population. You can find the dataset at eurostat

We only selected the EU countries and the years 2004 and 2024 and enhanced the dataset with images of the flags of the countries. The resulting dataset can be downloaded as EU population differences. It's only 3kb but that is enough to create an awesome chart.

Import the dataset