Select to view content in your preferred language

How can I edit the amount of classes in a bar chart?

439
1
09-09-2023 05:03 AM
TobiasWalter
New Contributor

I have got a column in an attribute table with values from about -10 to +200. I would like to create a bar chart whose x-axis only has two classes: The first class will have values from -10 up to -1 (only integer values exist), the second class contains all positive values from 0 to 200. How does this work? I don't find a way to edit the amount of classes.

At first, I wanted to create a pie chart, but I noticed quickly that pie charts cannot contain negative values....

0 Kudos
1 Reply
JohannesLindner
MVP Frequent Contributor

Instead of using a field as category, you can use an Arcade expression:

JohannesLindner_0-1694427980301.png

return IIf($feature.YourField < 0, "x < 0", "x >= 0")

 

Using this, you can easily create Bar and Pie Charts:

JohannesLindner_1-1694428043273.png

 

JohannesLindner_2-1694428074826.png

 

 

 

You can also use the expression to calculate a new field in your table and use that field as category field for bar/pie charts. This has the added advantage that you can also use it in other chart types. FOr example, here is a box plot of the integer values by category:

JohannesLindner_3-1694428401063.png

 

 


Have a great day!
Johannes