Skip to main content

Dear ODS Community

 

Is there a way to sort a stacked bar plot according to the total value of the individual bars. Looking at the example in the image, I would like the bar for “Wohnzonen” to be on top and the bar for “weitere_Bauzonen” to be at the bottom. Here is the code for the barplot:

 

<ods-chart scientific-display="false" 
single-y-axis="true"
labels-x-length=100
label-x="Hauptnutzung">
<ods-chart-query context="dvsareraum20250224"
field-x="ch_hauptnutzung_name"
reverse-stacks="true"
stacked="normal"
series-breakdown="standueberbauung_aggregiert"
sort="serie1-1">
<ods-chart-serie expression-y="flaeche_ha"
chart-type="bar"
index="0"
function-y="SUM"
color="range-custom"
display-values="true"
display-units="true"
scientific-display="true">
</ods-chart-serie>
</ods-chart-query>
</ods-chart>

 

Hi, unfortunately, the sort is not available for chart that are broken down with a second axe.

The default sort is alphabetical.

 

I encourage you to not breakdown if you can, and add a second ods-chart-query.

One chart is on a context filtered by Night Überbaut, and the other filtered by Überbaut.

You will sort by hauptnutzung the first ods-chart-query, and the second one will match.

 

 


Dear Frederic

 

Thank you for your answer and your hint to use multiple ods-chart-queries. I have managed to solve the problem using your suggestion.


Reply