小编sts*_*sdc的帖子

Vue Chart.js组件不呈现

仪表板获取具有10个元素的数据数组作为chdata属性.每0.5秒阵列更新一次新项目.我可以看到,数据在数据集中正在变化,但图表没有显示.

Uncaught TypeError: Cannot read property 'skip' of undefined悬停时也会出现此错误.

//LineChart.vue
<script>
import {
    Line,
    mixins
} from 'vue-chartjs'
export default Line.extend({
    mixins: [mixins.reactiveData],
    props: ["options"],
    data() {
       return {
            chartData: {
                labels: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
                datasets: [{
                    label: 'Data One',
                    borderColor: '#e67e22',
                    pointBackgroundColor: '#e67e22',
                    borderWidth: 1,
                    pointBorderColor: '#e67e22',
                    backgroundColor: 'transparent',
                    data: this.$root.$data.chdata
                }]
            },

         }
     },


    mounted() {
            this.renderChart(this.chartData, {
            responsive: true,
            maintainAspectRatio: false,
            animation: false,
            //Boolean - If we …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js chart.js vuejs2 vue-chartjs

5
推荐指数
1
解决办法
1166
查看次数

如何使用 Go 从磁盘读取文件并将其传递给 WebAssembly?

<input type="file">具体来说, Go中如何连接这个函数呢?我知道有“syscall/js”包,但我没有找到任何文件读取的示例。

func parseCSVFile(filePath string) []LabelWithFeatures {
    fileContent, _ := ioutil.ReadFile(filePath)
    lines := bytes.Split(fileContent, newline)
    numRows := len(lines)

    labelsWithFeatures := make([]LabelWithFeatures, numRows-2)

    for i, line := range lines {
        // skip headers
        if i == 0 || i == numRows-1 {
            continue
        }
        labelsWithFeatures[i-1] = NewLabelWithFeatures(bytes.Split(line, comma))
    }
    return labelsWithFeatures
}
Run Code Online (Sandbox Code Playgroud)

javascript go webassembly

4
推荐指数
1
解决办法
3961
查看次数

标签 统计

javascript ×2

chart.js ×1

go ×1

vue-chartjs ×1

vue.js ×1

vuejs2 ×1

webassembly ×1