Skip to content

ECharts can not be displayed in VSCode (and GitHub) #410

@maxandersen

Description

@maxandersen

trying to get echarts working with dflib: https://github.com/jupyter-java/jupyter-java-examples/blob/main/notebooks/java-dflib-echarts.ipynb

import org.dflib.echarts.*;

DataFrame df = DataFrame.foldByRow("name", "salary").of(
                "J. Cosin", 120000,
                "J. Walewski", 80000,
                "J. O'Hara", 95000)
        .sort($col("salary").desc());

var chart = ECharts
        .chart()
        .xAxis("name")
        .series(SeriesOpts.ofBar(), "salary")
        .plot(df);

        chart;

See that it does generates a html/text output cell with:

<script type='text/javascript' src='https://cdn.jsdelivr.net/npm/echarts@5.5.1/dist/echarts.min.js'></script>
<div id='dfl_ech_98' style='width: 600px;height:400px;'></div>
<script type='text/javascript'>
    var chart_dfl_ech_98 = echarts.init(
        document.getElementById('dfl_ech_98'),
        null,
   );
    var option_dfl_ech_98 = {
        dataset: {
            source: [
                ['L0','J. Cosin','J. O\'Hara','J. Walewski'],
                ['salary',120000,95000,80000]
            ]
        },
        xAxis: [
        {
            type: 'category'
        },
        ],
        yAxis: [
        {
            type: 'value'
        },
        ],
        series: [
            {
                name: 'salary',
                encode: {
                    x: 0,
                    y: 1,
                },
                seriesLayoutBy: 'row',
                type: 'bar'
            },
        ]
    };
    option_dfl_ech_98 && chart_dfl_ech_98.setOption(option_dfl_ech_98);</script>

but i cant get that to render in vscode jupyter notebook nor in github notebook preview.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions