dflib icon indicating copy to clipboard operation
dflib copied to clipboard

ECharts can not be displayed in VSCode (and GitHub)

Open maxandersen opened this issue 1 year ago • 10 comments

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/[email protected]/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.

maxandersen avatar Dec 18 '24 18:12 maxandersen