question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to plot X/Y Specific data

See original GitHub issue

Hello,

I have a huge array (sample below) with X and Y values and would like to plot the Y values on the X time, although I can not get my head around it. Any help please?

var dataPoints = [{x:0.000,y:-0.11700000},{x:0.003,y:-0.14400000},{x:0.007,y:-0.17500000},{x:0.010,y:-0.19200000},{x:0.013,y:-0.19900000},{x:0.017,y:-0.20500000},{x:0.020,y:-0.21000000},{x:0.023,y:-0.21400000}]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
nagixcommented, Mar 21, 2019

@lianglee You mean each datapoint has {x, y, timestamp} data? Chart.js doesn’t support a 3D chart with 3 axes, but a workaround would be to map either of x or y value to r (radius in a bubble chart) or a color scale (background color of point/rectangle elements).

If you just want to animate {x, y} data series and a time axis is not needed, you don’t need to use this plugin. Update {x, y} datasets and call the update function of the chart instance.

1reaction
nagixcommented, Feb 3, 2019

The x value can be in any of the date formats that Moment.js accepts. You can also use time.parser to specify a custom format to be used by Moment.js to parse the date.

{
    type: 'line',
    data: {
        datasets: [{
            data: [
                {x: '2019-02-01 09:30:15', y: -0.11700000},
                {x: '2019-02-01 09:30:20', y: -0.14400000},
                // ...
            ]
        }]
    },
    options: {
        scales: {
            xAxes: [{
                type: 'realtime'
            }]
        }
    }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Present your data in a scatter chart or a line chart
Select the data you want to plot in the chart. · Click the Insert tab, and then click X Y Scatter, and under...
Read more >
How To Plot X Vs Y Data Points In Excel | Excelchat - Got It AI
In Excel 2013 and later, we will go to the Insert Tab; we will go to the Charts group and select the X...
Read more >
Plotting an x-y graph in Excel – part 1 - YouTube
Screencast showing how to plot an x-y graph in Excel. Part 1: plotting the graph, using a secondary axis and adding axis titles....
Read more >
Plot X and Y Coordinates in Excel - EngineerExcel
Plot XY Coordinates in Excel by Creating a New Series​​ The lines extending from the x- and y-axes to the interpolated point (x-value,...
Read more >
X-Y Plots - Unistat Statistics Software
Date / Time X-Axis: When a date or time variable is selected for the X-Axis, the data points will be separated according to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found