Ask Your Question

How to make a chart with sorted values from a column? [closed]

asked 2012-12-13 11:41:35 +0100

hyogapag gravatar image

Maybe it will be clearer if I explain my use case. As a teacher, I give scores to students ranging from 0 to 20. I made a very simple table with names of the students, their various scores, and finally their average score. If I just take a line, it looks like this (csv style) :

DOE; John; 12; 8; 10;

I would like to display a chart next to this table, showing the average score of every student, but sorted in the ascending order. I know it would be possible to sort the column and then make the chart, but I would have to do this again every time I change or add a score. Is there a way to automatically sort results in the chart without altering the column?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2015-10-19 13:06:56.419055

1 Answer

Sort by » oldest newest most voted

answered 2012-12-13 16:38:59 +0100

w_whalley gravatar image

I assume that your chart is a bar chart with the student's names on the x-axis and the average score on the y-axis.

If you are willing to allow your table to be sorted, here's how to automatically update the chart as you want. Record a macro that sorts your grade table by the average score. Hook the macro to the "'Modified' status was changed" event for the spreadsheet. When you change a grade the chart is updated immediately. When you save the spreadsheet, the table is sorted and the chart is again updated using the sorted data.

If you want to maintain your original table sort order then it's more complicated, but doable. Your macro should copy your table and paste it as values-only in another location, then the macro would sort the copy on the average grade. The chart would be based on the data copy, not the original data. The macro would be hooked to the 'Modified' event as above. You will want to turn off the warning about pasting into existing data.

edit flag offensive delete link more


I assume your answer is correct but by now I can't validate it, as I discovered that the sort function is broken with my LO version (, at least under my OS (kubuntu). I provided some informations about this to an already existing unconfirmed bug ticket. I hope it will be corrected soon.

hyogapag gravatar imagehyogapag ( 2012-12-14 00:35:23 +0100 )edit

Question Tools


Asked: 2012-12-13 11:41:35 +0100

Seen: 3,718 times

Last updated: Dec 13 '12