naver / billboard.js

📊 Re-usable, easy interface JavaScript chart library based on D3.js
https://naver.github.io/billboard.js/
MIT License
5.79k stars 349 forks source link

Issue with region dasharray #3830

Closed Monty9120 closed 1 week ago

Monty9120 commented 1 month ago

Description

First of all, thank you for creating this library!

When using Regions with a large dataset (>600 datapoints) and enabling zoom, the dash-array does not render properly.

How can I ensure the stroke offset is consistent? For example if you add stroke-dasharray in CSS, it will automatically scale the line nicely.

Steps to check or reproduce

chart-zoom-issue

Example region setup:

{
    "region_id": [
        {
            "start": 65,
            "style": {
                "dasharray": "1 3"
            }
        }
    ]
}

Desired experience

The ideal look would be something like this, which is acheived with this CSS

.bb-chart-lines path.bb-line {
  stroke-dasharray: 11 !important;
}

chart-zoom-issue-fixed

netil commented 3 weeks ago

Hi @Monty9120, in most cases if you don't need draw dashed lines on specific region, css stroke-dasharray is the best option.

The current implementation is drawing dashed lines in single path with the combination of move and line command. There're some limitation for accuracy. I'll go over it to improve this.