Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line graph dashed line not working #19

Closed
CharlieTap opened this issue Aug 8, 2019 · 3 comments
Closed

Line graph dashed line not working #19

CharlieTap opened this issue Aug 8, 2019 · 3 comments

Comments

@CharlieTap
Copy link

Attempting to make a line graph with a simple dashed line and its not quite working, oddly it works just fine when using chart.js directly.

{
   "type":"line",
   "data":{
      "labels":[
         "July 19",
         "August 19",
         "Sept 19"
      ],
      "datasets":[
         {
            "data":[
               1.2,
               1.4
            ],
            "label":"Progress",
            "borderColor":"#1c60ab",
            "borderDash":[
               5,
               5
            ],
            "pointBackgroundColor":"#1c60ab"
         },
         {
            "data":[
               1.2,
               1.5,
               1.8
            ],
            "label":"Target",
            "borderColor":"#d7d8da",
            "borderDash":[
               5,
               5
            ],
            "pointBackgroundColor":"#d7d8da",
            "pointRadius":0
         }
      ]
   },
   "options":{
      "plugins":{
         "datalabels":{
            "display":false
         }
      },
      "scales":{
         "yAxes":[
            {
               "ticks":{
                  "beginAtZero":false
               }
            }
         ]
      },
      "elements":{
         "line":{
            "fill":false
         }
      }
   }
}
@typpo
Copy link
Owner

typpo commented Aug 8, 2019

Hi @CharlieTap,

This one took me a while to figure out. It's caused by this bug in the vm2 package, which is how we run sandboxed code for each chart: patriksimek/vm2#198

I put in a workaround that fixes the malformed array object that is produced, so things look good now:

image

Your browser may have cached the bad (non-dashed) images. If images you've loaded in the past are still rendering incorrectly you can clear your cache, change you config object slightly, or add a cache-busting param (e.g. q=<timestamp>) to your request in order to see the corrected graphs.

I'll keep this issue open until vm2 has fixed the problem and I can remove the workaround.

@CharlieTap
Copy link
Author

Perfect thank you

@typpo
Copy link
Owner

typpo commented Jan 31, 2020

Closing this now as the workaround is documented in code. Thanks for the report :)

@typpo typpo closed this as completed Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants