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.

Toolbar Disappears when data is loaded asynchronously

See original GitHub issue

Description

Toolbar Disappears when data is loaded asynchronously

Screenshot (if applicable)

Data Sample (if applicable)

The data sample must follow the current data structure.

Console errors (if any)

N/A

Additional Info

App.vue

<template>
    <trading-vue :data="chart" :width="width" :height="height"
        title-txt="BTCUSD"
        :toolbar="true"
        :overlays="overlays"
        :color-back="colors.back"
        :color-grid="colors.grid"
        :color-text="colors.text"
        :color-title="colors.tvTitle">
    </trading-vue>
</template>
<script>

import { DataCube } from 'trading-vue-js'
import Data from 'data.json'

export default {
    name: 'MainChart',
    props: ['width', 'height', 'colors'],
    data() {
        return {
            chart: {},
            overlays: []
        }
    },
    mounted(){
      this.$set(this, 'chart', new DataCube(Data))
    }
}
</script>
<style>
</style>

Data.json

{
    "chart": {
        "type": "Candles",
        "indexBased": true,
        "data": [
            [
                1092873600000,
                100.01,
                104.06,
                95.96,
                100.335,
                44659000
            ],
            [
                1092960000000,
                101.01,
                109.08,
                100.5,
                108.31,
                22834300
            ],
            [
                1093219200000,
                110.76,
                113.48,
                109.05,
                109.4,
                18256100
            ],
            [
                1093305600000,
                111.24,
                111.6,
                103.57,
                104.87,
                15247300
            ],
            [
                1093392000000,
                104.76,
                108.0,
                103.88,
                106.0,
                9188600
            ],
            [
                1093478400000,
                104.95,
                107.95,
                104.66,
                107.91,
                7094800
            ],
            [
                1093564800000,
                108.1,
                108.62,
                105.69,
                106.15,
                6211700
            ],
            
            [
                1592265600000,
                1449.0,
                1457.17,
                1428.99,
                1446.47,
                1534826
            ],
            [
                1592352000000,
                1452.94,
                1462.2,
                1435.12,
                1452.54,
                1530500
            ],
            [
                1592438400000,
                1449.85,
                1452.97,
                1426.23,
                1434.12,
                1743071
            ],
            [
                1592524800000,
                1440.0,
                1444.5,
                1419.0,
                1424.64,
                2639167
            ],
            [
                1592784000000,
                1425.01,
                1450.95,
                1419.19,
                1450.66,
                1472072
            ],
            [
                1592870400000,
                1452.0,
                1475.2,
                1445.0,
                1463.98,
                1887583
            ],
            [
                1592956800000,
                1463.28,
                1475.79,
                1430.0,
                1432.7,
                1579579
            ],
            [
                1593043200000,
                1431.22,
                1442.32,
                1419.54,
                1441.1,
                1197907
            ],
            [
                1593129600000,
                1432.63,
                1437.02,
                1355.0,
                1362.54,
                4882014
            ]
        ]
    },
    "onchart": [
        {
            "name": "Trades",
            "type": "Trades",
            "data": [
                [
                    1100476800000,
                    1,
                    0,
                    184.87,
                    "17.49%"
                ],
                [
                    1101772800000,
                    1,
                    0,
                    181.98,
                    "7.31%"
                ],
                [
                    1109635200000,
                    1,
                    1,
                    186.06,
                    "9.16%"
                ],
                [
                    1113177600000,
                    1,
                    1,
                    193.23,
                    "5.43%"
                ],
                [
                    1113782400000,
                    1,
                    0,
                    186.97,
                    "8.88%"
                ],
                [
                    1113868800000,
                    0,
                    1,
                    191.4,
                    "4.11%"
                ],
            ],
            "settings": {
                "z-index": 10,
                "labelColor": "#dedddd"
            }
        }
    ]
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

2reactions
C451commented, Jul 18, 2020
1reaction
arunavo4commented, Jul 19, 2020

@C451 Yup, It Works. Thanks a lot! The issue was I had to reset the chart soon after adding the data. this.$refs.tvjs.resetChart()

Here is how it is for anyone visiting this issue in the future.

mounted() {
        window.addEventListener('resize', this.onResize)
        // Api Call
        this.axios
        .post(`/backtest/detailedAnalysis/${this.strategyId}/${this.runId}/`
        )
        .then(response => {
            this.$set(this, 'chart', new DataCube(response.data))
            this.$refs.tvjs.resetChart()
        })
        .catch(error => {
            console.log(error)
            this.errored = true
        })
        .finally(() => {
            this.loading = false;
        })

    },
Read more comments on GitHub >

github_iconTop Results From Across the Web

blazor grid using async doesn't always display data - Syncfusion
When populating a grid in an async function, it does not always properly load and display the data. Most of the time, it...
Read more >
jquery - content disappears with jquerymobile (video demonstration ...
I cant seem to figure why content within the div data-role='content' disappears on Android 4.03+. On iOS Safari and Chrome for Android there...
Read more >
Progress indicators - Status - Human Interface Guidelines
Progress indicators let people know that your app isn't stalled while it loads content or performs lengthy operations.
Read more >
Working with the AppBar - Android Developers
The top app bar provides a consistent place along the top of your app window for displaying information and actions from the current...
Read more >
Loading data pages asynchronously - Pega Documentation
Enable users to take action on a work item while the system is loading other content by configuring data pages to load asynchronously....
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