Giter Club home page Giter Club logo

Comments (4)

zeroasterisk avatar zeroasterisk commented on May 3, 2024 1

πŸ‘ thanks a bunch!

from react-chartjs-2.

gor181 avatar gor181 commented on May 3, 2024

Hey @zeroasterisk ,

Apologies for late reply.
Just added an example to https://github.com/gor181/react-chartjs-2/blob/master/example/src/components/mix.js

Cheers.

from react-chartjs-2.

gor181 avatar gor181 commented on May 3, 2024

cuddos to http://plnkr.co/edit/TvY5tz?p=preview for a example.

from react-chartjs-2.

RuiSa avatar RuiSa commented on May 3, 2024

Hey guys,
I need to create a dot inside a Line Chart. I started by mixing the line chart with the bubble chart. The thing is that the data array passed to the bubble configuration needs to have the same length as the line chart configuration otherwise the bubble doesn't move in the x-axis.

In resume:

With the next configuration it created bubbles along the x axis with y=0 with the one with value 57 as the only bubble i want to show

var data = {
labels: [0,1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,'um ano',1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,'2 anos'],
datasets: [{
type: 'line',
label: 'My First dataset',
fill: false,
lineTension: 0.1,
backgroundColor: 'rgba(75,192,192,0.4)',
borderColor: 'rgba(75,192,192,1)',
borderCapStyle: 'butt',
borderDash: [],
borderDashOffset: 0.0,
borderJoinStyle: 'miter',
pointBorderColor: 'rgba(75,192,192,1)',
pointBackgroundColor: '#fff',
pointBorderWidth: 1,
pointHoverRadius: 5,
pointHoverBackgroundColor: 'rgba(75,192,192,1)',
pointHoverBorderColor: 'rgba(220,220,220,1)',
pointHoverBorderWidth: 2,
pointRadius: 1,
pointHitRadius: 10,
data: [20,25,30,37,47,59,71,85,93,97,101,105,104,103,102,101,101,102,102,102,103,103,103,103,103]
},
{
type:'bubble',
label:'calculado',
fill: false,
lineTension: 0.1,
backgroundColor: 'rgba(75,192,192,0.4)',
borderColor: 'rgba(75,192,192,1)',
borderCapStyle: 'butt',
borderDash: [],
borderDashOffset: 0.0,
borderJoinStyle: 'miter',
pointBorderColor: 'rgba(75,192,192,1)',
pointBackgroundColor: '#fff',
pointBorderWidth: 1,
pointHoverRadius: 5,
pointHoverBackgroundColor: 'rgba(75,192,192,1)',
pointHoverBorderColor: 'rgba(220,220,220,1)',
pointHoverBorderWidth: 2,
pointRadius: 1,
pointHitRadius: 10,
data: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,57,0,0,0,0,0,0,0,0,0]
}
]
};

With the next configuration it created one bubble with the y value right and x value 0 (wrong):

var data = {
labels: [0,1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,'um ano',1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,'2 anos'],
datasets: [{
type: 'line',
label: 'My First dataset',
fill: false,
lineTension: 0.1,
backgroundColor: 'rgba(75,192,192,0.4)',
borderColor: 'rgba(75,192,192,1)',
borderCapStyle: 'butt',
borderDash: [],
borderDashOffset: 0.0,
borderJoinStyle: 'miter',
pointBorderColor: 'rgba(75,192,192,1)',
pointBackgroundColor: '#fff',
pointBorderWidth: 1,
pointHoverRadius: 5,
pointHoverBackgroundColor: 'rgba(75,192,192,1)',
pointHoverBorderColor: 'rgba(220,220,220,1)',
pointHoverBorderWidth: 2,
pointRadius: 1,
pointHitRadius: 10,
data: [20,25,30,37,47,59,71,85,93,97,101,105,104,103,102,101,101,102,102,102,103,103,103,103,103]
},
{
type:'bubble',
label:'calculado',
fill: false,
lineTension: 0.1,
backgroundColor: 'rgba(75,192,192,0.4)',
borderColor: 'rgba(75,192,192,1)',
borderCapStyle: 'butt',
borderDash: [],
borderDashOffset: 0.0,
borderJoinStyle: 'miter',
pointBorderColor: 'rgba(75,192,192,1)',
pointBackgroundColor: '#fff',
pointBorderWidth: 1,
pointHoverRadius: 5,
pointHoverBackgroundColor: 'rgba(75,192,192,1)',
pointHoverBorderColor: 'rgba(220,220,220,1)',
pointHoverBorderWidth: 2,
pointRadius: 1,
pointHitRadius: 10,
data: [{ x: 10, y: 20, r: 5 }]
}
]
};

The render:

var LineChart = require('react-chartjs-2').Line;

LineChart ref='chart' data={data} options={options}

Thank you in advance

from react-chartjs-2.

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.