question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[DISCUSSION] Referencing chart.js through our library

See original GitHub issue

In the README and in our samples, we reference chart.js and moment.js through our library with the _content directory added by blazor. It’s included in the sources of this library and is automatically integrated into the client-side root of applications that consume this library.
But why?

We can write what version of chart.js we currently support and we can let the consumer chose themselfs how to include the chart.js. We can also let them chose if they want the minified version or not. Why should we include the JavaScript-file of chart.js in our library as well, doesn’t it just bloat the nuget size?

It would be a breaking change to remove it but here’s why I think it would make sense.

Pro

  • Smaller nuget-size
  • We can keep the type files for TypeScript, no need to change that
  • When we migrate to chart.js 3.0, we’ll have trouble with the time-adapters anyway. You don’t need moment.js anymore, you can use any time-adapter you want. So which one would we have in our library?
  • More flexible for the consumer (minified, version, cdn)
  • Only the script tag in the _Host.cshtml or index.html would change in the consumers application

Contra

  • Breaking change, consumers need to change some code
  • We need to clearly document what version we support and be aware of it (this is actually a benefit IMO but it requires additional work)

If possible, I would like to hear some opinions on this before we decide anything. Can anyone tell us some good arguments for keeping it in? Or do you agree with me that it should be excluded from the project and just be documented well?

cc @mariusmuntean

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Joelius300commented, Oct 20, 2020

Closing this because I recently removed the pre-built Chart.js code and also all moment.js stuff. When I release 2.0, I’ll update the readme to use a CDN link with a notice that you can download the latest builds from the Chart.js page if you don’t want to use a CDN. I think that’s a good way to handle it.

0reactions
SeppPennercommented, Oct 20, 2020

@Joelius300 Yeah, this seems like a good idea.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chart.js
Chart.js renders chart elements on an HTML5 canvas unlike several others, mostly D3.js-based, charting libraries that render as SVG. Canvas ...
Read more >
Introducing Chart.js: A Powerful JavaScript Library for ...
Chart.js is a versatile and user-friendly JavaScript library that empowers developers to create stunning and interactive charts and graphs for data ...
Read more >
Chart.js advantages and prominent features explained
On the website, Chart.js is described as "Simple yet flexible JavaScript charting for designers & developers" (arguably, not the best way to ...
Read more >
chart.js Failed to create chart: can't acquire context from the ...
In both cases I was getting this error: chart. js Failed to create chart: can't acquire context from the given item. Even after...
Read more >
Comparing the most popular JavaScript charting libraries
In this article, we'll review some of the most popular JavaScript charting libraries, including HighCharts, Chart.js, C3.js, Chartist, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found