Skip to content

logarithmic Line chart: line segments not displayed if starting or ending at y=0 #9978

Description

@sboggs-trs

Expected Behavior

(This seems related to, maybe overlaps, Refine logarithmic scaling / tick generation #9166)
(This also seems related to v3 Regression: Line doesn't draw when points are out of range #9564)

In a line chart with logarithmic y scale, gridline/tick y=0 should be displayed at all times (at least an option to, as in version 2), and all line segments should be displayed - even if the segment originates or ends at y=0.

Current Behavior

In a line chart with logarithmic y scale, any line segment will not be displayed if the segment originates or ends at y=0.
This might be due to the chart not including a tick at y=0.

Possible Solution

In chartjs 2, we were able to display a chart with the Y-axis starting at 0, by setting beginAtZero like so:

     y: {
         ticks: {
                  beginAtZero: true,
         },
     }

Adding this property might make the most sense.

Steps to Reproduce

Here is a Stackblitz. Notice that the 1st line segment (originating at (0, 0) ) does not display.

Context

Currently unable to update from chartjs2 until this (and some issues probably handled by Refine logarithmic scaling / tick generation #9166) is not an issue. Here is a screenshot capturing the desired appearance, from a (stepped Line) chartjs-2 created by someone else:
image

Environment

  • Chart.js version: 3.6.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions