Git Product home page Git Product logo

chartjs-plugin-error-bars's People

Contributors

dg-datavisyn avatar dvvanessastoiber avatar flothoni avatar jdrodjpl avatar jeredmasters avatar puehringer avatar rumersdorfer avatar sgratzl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

chartjs-plugin-error-bars's Issues

ctx undefined

I'm using the plugin with chartjs 2.4.0 and it doesn't work. There's an error on line 196 of Plugin.Errorbar.js.

      var errorBarColors = Array.isArray(options.color) ? options.color : [options.color];
      var ctx = chart.ctx;
      ctx.save(); // map error bar to barchart bar via label property

ctx is accessible at the second level, that is chart.chart (basically the chart object has another chart field, and the the context)

The code should be

      var errorBarColors = Array.isArray(options.color) ? options.color : [options.color];
      var ctx = chart.chart.ctx;
      ctx.save(); // map error bar to barchart bar via label property

Edit: I used the master branch and built the lib using npm install & npm run build

Bug in accessing `chart.data.dataset[i]`

The current version of the master branch has a bug when accessing the dataset line 191 of plugin.js. This leads to errors on the console and does not show any error bars.

Please replace chart.data.dataset[i] by chart.data.datasets[i] to fix it. Or remove the whole if-clause from line 191 to line 196 (as done in develop branch).

data scaling

https://codepen.io/sgratzl/pen/PBLeJK?editors=0010

I don't understand how the error bars are scaled or defined. I define the value to be 50 and plus: 20 and minus: -30

the result looks like that:

image

I would expect that the upper bar is at 70 and the lower at 20 assuming these are relative values to the base value. I cannot be percentage values either since it doesn't work out with value=100 + 20% = 120 either.

error bars not appearing when graph is created with x axis as time series

Hi,

When creating a graph with the options :
scales: { x: { type: 'time', distribution: 'series', time: { unit: 'day' } } }

Any datasets with type lineWithErrorBars or barWithErrorBars (didn't test others), won't be displayed.
Same thing when you update datasets after the graph is created.

Of course if you create a graph with no time series for x, the line and bar with error dataset show normally.

After graph is created with no time series, if you update x axis to become time series and if the error bar dataset is already displayed, it will stay and work normally.

Is there support for hiding the bars for zero values?

Are there any display options or scriptable ways to enable and disable error bars for values that are 0? Drawing the error bar when there is not a confidence interval or when the value is zero makes for a distracting chart.

Update Codeowner

The code owner of this repository has changed, therefore it is necessary to update the repo.

Error bars appear on top of tooltips

The error bars appear to have a higher z-index than the default tooltips that Chart.js creates on the canvas. This can make the tooltips really hard to read with dense datasets:

image

Multi-lined labels string[][]

ChartJS allows multi-lined labels of type string[][], but you can't have an array as a key. How to add error deviations to a data with multi-lined label as string[] array label?

  data: {
    labels: [['January', 'January line 2'], ['February', 'February line 2'], ['March', 'March line 2']],
    datasets: [{
      ...
      errorBars: {
        'February': {plus: 15, minus: -34}, // the label is not 'February' but ['February', 'February line 2'] ???
        'March': {plus: 5, minus: -24}
      },
...

How to add the {plus, minus} error object to the labels[0] which is of type string[] - [string, string] while you can't have a string[] key?

Allow for linear/date scales on line charts

Hi,

Would you consider index-based errorBars data, rather than currently only supporting key based (even if you have tree models)?

I have a line chart, with a linear scale, where the labels are generated by using the Date() of the data row. This makes it impossible to use keys for the errorBars data.

I managed to get the plugin working as I needed by changing "dataset.forEach((bar) => {" to "dataset.forEach((bar, ii) => {" on line 191, and then adding this after line 204:
} else if (!hasLabelProperty && cur[ii]) { errorBarData = cur[ii];

Thanks

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.