Git Product home page Git Product logo

Comments (5)

sgratzl avatar sgratzl commented on May 27, 2024

can you create a codesandbox, codepen, ... where I can reproduce the error?

from chartjs-chart-error-bars.

njdavis avatar njdavis commented on May 27, 2024

If I have time later tonight, I'll try to create a codepen. I just wanted to say that this bug is showing up for me as well, whenever I use 3.9.0. It seems to work fine for 3.8.0, and below.

from chartjs-chart-error-bars.

AlonMiz avatar AlonMiz commented on May 27, 2024

it does work on version 3.8.0

from chartjs-chart-error-bars.

sgratzl avatar sgratzl commented on May 27, 2024

one code change I can think of is e2aae8a#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519 which removes the "browser" field from th the package.json but I don't know how that could effect things.

from chartjs-chart-error-bars.

sgratzl avatar sgratzl commented on May 27, 2024

this works just fine for me:

import { Chart as ChartJS, Title, Tooltip, LinearScale, CategoryScale, BarElement } from 'chart.js';
import {
    BarWithErrorBar,
    BarWithErrorBarsController,
    PointWithErrorBar,
} from 'chartjs-chart-error-bars';
import { Chart } from 'react-chartjs-2';

// these all registers i tries to add
ChartJS.register(
    PointWithErrorBar,
    BarWithErrorBarsController,
    BarWithErrorBar,
    LinearScale,
    CategoryScale,
    BarElement,
    LinearScale,
    CategoryScale,
    Title,
    Tooltip,
);

const options = {
    // annotations,
    scales: {
        x: {
            // type: 'time',
            // ticks: {
            //     source: 'auto',
            // },
        },
        y: {
            suggestedMin: 0,
        },
    },
};

const getChartDatasets = (data) => ({
    labels: data.map(({ x }) => x),
    datasets: [
        {
            data,
        },
    ],
});


export const BarChartWithErrors = () => {
    return <Chart
        type="barWithErrorBars"
        data={getChartDatasets([{ x: 'a', y: 3, yMin: 1, yMax: 4 }, { x: 'b', y: 2 }, { x: 'c', y: 1 }])}
        width={300}
        height={200}
        options={options}
    />
}

"chartjs-chart-error-bars": "^3.10.0",
"chart.js": "^3.9.1",
"react-chartjs-2": "^4.3.1",

image

from chartjs-chart-error-bars.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.