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.

vuejs2: strange chart look

See original GitHub issue

Trying render chart billboard.js at vue.js2 package.json:
“billboard.js”: “^1.2.0”, “vue”: “^2.2.2”,

import: import {bb} from 'billboard.js'

Generate chart:

     var chartbb = bb.generate({
        bindto: '#bbChart',
        data: {
          columns: [
            ['data3', 300, 200, 160, 400, 250, 250]
          ],
          type: 'spline'
        }
      })

      setTimeout(function () {
        chartbb.load({
          columns: [
            ['data7', -130, -150, -200, -300, -200, -100]
          ]
        })
      }, 2000)

insert into code.vue: <div id="bbChart" ></div> And get this: vue_billboard Seems to that library it’s not correct import… There are no proper styling chart, axes, series.

Steps to check or reproduce

Any suggestions what I’m doing wrong? Maybe should import style.css? But how?

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
rshingletoncommented, Feb 15, 2018

I often find that this is the case with packages that have css as part of the project. For these cases I include a scss file as part of my main project in webpack and do my imports there so they are globally scoped.

For example:

My webpack.config.js looks something like this:

const path = require("path");
const srcDir = path.resolve(__dirname);
const baseDir = path.resolve(__dirname, "..");
const pluginsConfig = require(path.resolve(baseDir, 'config/webpack.plugins.config.js'));
const rulesConfig = require(path.resolve(baseDir, 'config/webpack.rules.config.js'));

module.exports = {
    context: path.resolve(__dirname, ".."),
    entry: {
        index: [
            srcDir + '/src/main.js',
            srcDir + '/src/main.scss'
        ]
    },
    output: {
        filename: "vendor/js/vendor_dll.js",
        path: exportPath,
        library: "vendor_dll",
    },
    resolve: {
        modules: [
            path.join(__dirname, "..", "node_modules"),
        ],
        extensions: [".js", ".jsx", '.ts', '.vue',],
        alias: {
            'vue$': 'vue/dist/vue.esm.js',
        }
    },
    plugins: pluginsConfig,
    module: {
        rules: rulesConfig
    }
};

And in my main.scss file: (note that ~ resolves to the node_modules directory)

$fa-font-path: "~font-awesome/fonts";
@import "~font-awesome/scss/font-awesome";
@import '~buefy/lib/buefy.css';
@import '~flatpickr/dist/flatpickr.css';
@import "~billboard.js/dist/billboard.css";
1reaction
ilya-vasilyevcommented, Feb 14, 2018

I added this into <style>...</style> section of my App.vue file:

@import "billboard.js/dist/billboard.min.css";

It works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Computed property as reactiveprop to vue-chartjs?
We'd need to see the chart options to see if it's the same underlying cause. Your axes options should look something like this:...
Read more >
Building Table Sorting and Pagination in Vue.js
Building Table Sorting and Pagination in Vue.js ... I've got a table with four columns: Name, Age, Breed, and Gender. And then I...
Read more >
Watchers | Vue.js
Watchers declared using the watch option or the $watch() instance method are automatically stopped when the owner component is unmounted, so in most...
Read more >
Charting with Vue: A comparison - LogRocket Blog
I'm curious how much each chart solution will make me change my data to ... time in Chart.js by itself first before looking...
Read more >
Using Slots In Vue.js - Smashing Magazine
Let's take a look at how to use slots and some examples of how they can be used in your Vue applications. ......
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