Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

509
Views
How to create apexcharts (javascript) using json local file?

As the title say, I want to create apexchart using json data that I downloaded beforehand

I already search in internet to get json data use :

const df= require('data/processed.json');

And I already tried to call it df['liked'] as y and df['name'] as x

Is there something I miss? Or call the column is not gonna do it? I have also tried df.liked and df.name, btw

const df= require('data/processed.json');
var options = {
        chart: {
            height: 230,
            type: 'line',
            toolbar: {
                show: false,
            },
        },
        dataLabels: {
            enabled: false
        },
        stroke: {
            width: 2,
            curve: 'smooth'
        },
        series: {
            name: 'Liked',
            data: df['liked']
        },
        legend: {
            position: 'top',
        },
        xaxis: {
            type: 'string',
            data: df['name'],
            axisBorder: {
                show: false,
            },
            label: {
                style: {
                    color: '#ccc'
                }
            },
        },
        yaxis: {
            show: true,
            // min: 10,
            // max: 70,
            labels: {
                style: {
                    color: '#ccc'
                }
            }
        },
        colors: ['#73b4ff', '#59e0c5'],
        fill: {
            type: 'gradient',
            gradient: {
                shade: 'light',
                gradientToColors: ['#4099ff', '#2ed8b6'],
                shadeIntensity: 0.5,
                type: 'horizontal',
                opacityFrom: 1,
                opacityTo: 1,
                stops: [0, 100]
            },
        },
        markers: {
            size: 5,
            colors: ['#4099ff', '#2ed8b6'],
            opacity: 0.9,
            strokeWidth: 2,
            hover: {
                size: 7,
            }
        },
        grid: {
            borderColor: '#cccccc3b',
        }
    }
    var chart = new ApexCharts(document.querySelector("#unique-visitor-chart"), options);
    chart.render();

enter code here
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

try to use :

 const df = fetch("./data/processed.json")
        .then(response => {
            return response.json();
        })

A documentation about fetch

This way will catch all data on your json and pu it in your const df by using the return :)

If you want to use require() look about : https://requirejs.org/

NOTE : Try to use a lot console.log() to debug your js app.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!