문제

I'm trying to set the initial visiblity of some dygraphs data series by column name.

This is because the data comes from a CSV file with columns that may come or go, but I know that a couple of the columns I want to be disabled by default - but I don't know what column number they may be (just the name).

I'm new to javascript, so the answer is likely simple. I'm trying to do this:

<script type="text/javascript">
    g = new Dygraph(
        document.getElementById("graphdiv"),  // containing div
        "last/test.csv",
        {
            connectSeparatedPoints: true,
            includeZero: true
        }
    );

    g.setVisibility(g.indexFromSetName("writer_write_start") - 1, 0);
</script>

But this gives me an error. If I run the setVisibility command from the javascript console or an onclick event, it works fine. I suspect it's something to do with the Dygraph not being fully loaded by the time I try to run methods referring to data in the CSV file, and I need to run this in some other way after the dygraph has fully loaded.

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top