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

Can not render two lines at the same time #83

Closed
river2333 opened this issue Mar 28, 2017 · 1 comment
Closed

Can not render two lines at the same time #83

river2333 opened this issue Mar 28, 2017 · 1 comment

Comments

@river2333
Copy link

Expected Behavior

When i use LineChart with local data, it can not render two lines at the same time,only display one line.
But,directly in the data attribute assignment can show two lines.

Actual Behavior

Below,in data function

   data() {
        return {
            datacollection: {
                labels: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"],
                datasets: [{
                    label: '卡路里',
                    borderColor: "#00BA9B",
                    borderWidth: '5px',
                    lineTension: 0,
                    backgroundColor: 'transparent',
                    pointStyle: 'rect',
                    data: []
                }, {
                    label: '时间',
                    borderColor: "#e1316f",
                    borderWidth: '5px',
                    lineTension: 0,
                    backgroundColor: 'transparent',
                    pointStyle: 'rect',
                    data: []
                }]
            }
}

Listen to the calculation properties by watch

 watch: {
        weekly(var1) {
            this.datacollection.datasets[0].data = var1.chart.kcals;
            this.datacollection.datasets[1].data = var1.chart.times;
        }
    },

The following is to get the data in the calculation properties

computed: {
        weekly: function() {
            return this.$store.state.weekly.weekly
        }
    },

please forgive me mine bad English ,if you can not understand, do not have to understand the hard.

Environment

  • vue.js version: <2.0>
  • vue-chart.js version:
  • npm version:
@river2333
Copy link
Author

Problem solved

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

1 participant