Code Monkey home page Code Monkey logo

Comments (3)

leeoniya avatar leeoniya commented on May 10, 2024

i think a scatter plot at the density of the bench would perform worse than a line chart, but this would be true of any chart lib. i do plan on adding an option to also render data points (whether or not it's a good idea for the data quantity is another matter). i think adding an option afterwards to disable line drawing should be easy.

i think this would logically follow #2

from uplot.

leeoniya avatar leeoniya commented on May 10, 2024

i may have to walk back on this one. the main issue is that a single series cannot have multiple y values at the same x, and all series require matched x's. uPlot expects a csv-like data structure:

const data = [
  [1566453600, 1566457260, 1566460860, 1566464460],   // Unix timestamps
  [0.54,       0.15,       3.27,       7.51      ],   // CPU
  [12.85,      13.21,      13.65,      14.01     ],   // RAM
  [0.52,       1.25,       0.75,       3.62      ],   // TCP Out
];

it relies on a binary search over the ascending x values to look up the corresponding values of y at that single point. even if you sorted x/y pairs by their x values, uPlot requires that everything is properly aligned. let's say you had these x/y pairs: [2,5], [2,9], [4,7], [5,1], the data would need to be massaged into this format of multiple series:

const data = [
  [2,    4,    5], 
  [5,    7,    1]
  [9, null, null],
];

it's an ugly, inefficient hack. ideally, an efficient scatterplot dataset would look like this:

const data = [
  [2, 5, 2, 9, 4, 7, 5,1]    // series 1
  ...
];

but this would drastically change the way in which data is searched, iterated, re-scaled, etc. i think that probably only 50% of the existing code could be reused (mostly related to DOM and actual Canvas loops), but everything else would have to be written differently.

from uplot.

leeoniya avatar leeoniya commented on May 10, 2024

long story short, i dont see this happening in the near future, though additional chart types which can be represented by the current data structure will be supported (see #9)

from uplot.

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.