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

95
Views
Implementing Data Decimation in vue chartjs

I've been trying and failing to implement data decimation in vue chartJS, I'm assuming parsing is the hurdle stopping me as it is the one requirement I cant seem to fulfil.

  1. The dataset must have an indexAxis of 'x'
  2. The dataset must be a line
  3. The X axis for the dataset must be either a 'linear' or 'time' type axis
  4. Data must not need parsing, i.e. parsing must be false
  5. The dataset object must be mutable. The plugin stores the original data as dataset._data and then defines a new data property on the dataset.

My current chart options are:

oilOptions: {
    responsive: true,
    scales: {
        y: {
            ... // Formatting and title
        },
        x: {
            type: 'time'
            ... // Formatting and title
        }
    },
    plugins: {
        title: {
            ...
        },
        zoom: {
            ...
        },
        decimation: {
            enabled: true,
            algorithm: 'lttb',
            samples: 500
        }

The dataset is historical Brent oil price data structured like:

{
    labels: [
        "1987-05-20",
        "1987-05-21",
        ...
     ],
     datasets: [
        label: "Brent Oil Price",
        fill: false,
        borderWidth: 2,
        borderColor: "rgb(75, 192, 192)",
        tension: 0.5,
        pointRadius: 0,
        // parsing: false (This stops data from rendering anyway)
        data: [
                18,
                18,
                ...
        ]
     ]

I'm using vue-chartjs but that shouldn't be an issue.

Any help would be appreciated, my other option would be to reduce the data on the backend before passing it to the client, or have a separately saved reduced data set on my DB.

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

0

No parsing means that you need to provide the data like the internal format so no labels array and objects in your data array like so:

{
  datasets: [{
    label: "Brent Oil Price",
    fill: false,
    borderWidth: 2,
    borderColor: "rgb(75, 192, 192)",
    tension: 0.5,
    pointRadius: 0,
    parsing: false
    data: [{
        x: '1987-05-20',
        y: 5
      },
      {
        x: '1987-05-21',
        y: 6
      }
    ]
  }]
}

The internal data format can be found in the docs here

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!