Chart.js: [Bug/Docu Issue] Mixed Charts: "Drawing Order" processed in wrong order

Created on 22 Jun 2020  路  1Comment  路  Source: chartjs/Chart.js

Expected Behavior

According to the latest documentation I need to set a higher number in the dataset that I want to be on top of another dataset.
Quoting from the example:

// this dataset is drawn below
            order: 1
// this dataset is drawn on top
            order: 2

Current Behavior and Steps to Reproduce (for bugs)

At the moment it is the other way around. The dataset with the lower number will be drawn on top of the other one.
Look at this jsfiddle where the lines are supposed to be on top of the bars but that is not the case.
In order to get the right chart I need to change the order number of the lines and the bars and get this new jsfiddle

Possible Solution

This might be a documentation issue or an issue with the drawing order code itself. Personally I prefer the behavior the documentation currently suggests.
But I am not sure which behavior is the intended one and thus can't really solve this issue.
If this is a problem with the documentation then the paragraph about drawing order needs to be adjusted.
But if this is not intended the code needs to be changed in order to process the drawing order right.

Environment

  • Chart.js version: 2.9.3
  • Browser name and version: Google Chrome (Version 83.0.4103.106) [should not matter]
bug

Most helpful comment

The documentation has been fixed in master / next

>All comments

The documentation has been fixed in master / next

Was this page helpful?
0 / 5 - 0 ratings