Giter VIP home page Giter VIP logo

Comments (11)

lcallarec avatar lcallarec commented on July 21, 2024 3

Opened #12, I close this one, the main issue about hiding chart parts and grid configuration has been resolved.

from live-chart.

lcallarec avatar lcallarec commented on July 21, 2024 1

Looks like good improvements. I'll work on it soon.

However, I'm not sure what do you meant by "chart border". Is it to mimic the grey border and margin of the panel of opened files above button line in your screenshot ?

from live-chart.

lcallarec avatar lcallarec commented on July 21, 2024 1

Working on it. It'll be ready soon.

from live-chart.

lcallarec avatar lcallarec commented on July 21, 2024 1

In release 1.3.0 :

  • Legend can de hidden
  • Labels can de hidden
  • Guidelines can be hidden
  • Custom width, color and dash style on guidelines
  • Axis can be hidden or customized (width, color and dash style)

Documentation has been updated to reflect the changes. Please let me know if it's clear enough or if the documentation needs to be rewritten.

from live-chart.

lcallarec avatar lcallarec commented on July 21, 2024 1

There's nothing wrong, as long as it fits your needs :)

So, right now, the solution will be to

  • clear the underlying Values object of a serie renderer
  • manually compute back, for each point, the related timestamp (2s behind now for each measure in your case)
var renderer = new LiveChart.SmoothLineArea();
var cpu = new LiveChart.Serie("CPU", renderer);

var chart = new LiveChart.Chart();
chart.add_serie(cpu);
//Other stuff

//To add the CPU history 

var values = renderer.get_values();
values.clear(); // Clear all the data

//Here's your own data from ArrayList<double>
var cpu_history = new Gee.ArrayList<double?>();
cpu_history.add(10);
cpu_history.add(30);
cpu_history.add(20);
cpu_history.add(40);
cpu_history.add(20);
cpu_history.add(60);
cpu_history.add(30);
cpu_history.add(90);

var refresh_rate_is_ms = 2000; //your own refresh rate in milliseconds
var now = GLib.get_real_time() / 1000; //now in milliseconds

//the  timestamp of the first point
//we are considering that it is "now", but because of your data structure
//it can be between now and now - 2secs), we can't guess
var ts = now - (cpu_history.size * refresh_rate_is_ms); 

cpu_history.foreach((value) => {
    values.add({ts, value});    
    ts += refresh_rate_is_ms;
    return true;
});

By the way, I also need such feature, so I will add some convenient methods to help dealing with the underlying Values object.

But if you don't store a timestamp alongside your data, you'll need to guess them with extra code, and by "guess" I mean that your data points time precision will not be guaranteed (epsilon = 2000ms in your case).

Maybe I could add conversion methods between timestamp unaware collection and TimestampedValue in LiveChart library ; let me think if it makes sense.

from live-chart.

stsdc avatar stsdc commented on July 21, 2024 1

Works like a charm 😌️
Built in conversion to a TimestampedValue would be awesome 🤓
Screen record from 2020-04-09 23 05 43
.

from live-chart.

stsdc avatar stsdc commented on July 21, 2024

The border I meant:
obraz

from live-chart.

stsdc avatar stsdc commented on July 21, 2024

Also would be nice to control:

  • grid colour
  • grid lines (only vertical or horizontal)
  • grid line style (solid, dotted, dashed)
  • grid line weight

Sorry that's a lot 😬 😅️

from live-chart.

stsdc avatar stsdc commented on July 21, 2024

Wondering how to easily clear a serie 🤔

e.g.:

  1. clicking new process to load new buffer which contains CPU usage history
  2. previous buffer is cleared
  3. adding new buffer (I'm saving data in ArrayList) (should I do foreach here?)

What do You recommend?

from live-chart.

lcallarec avatar lcallarec commented on July 21, 2024

Hmmm, just a question. You are storing CPU usage history in an ArrayList, but are you storing values and related timestamps ?

from live-chart.

stsdc avatar stsdc commented on July 21, 2024

I'm not storing them, because chart is in the representative layer and process cpu history is in lower layer of model-controller. Every 2s I'm updating ArrayLists of all processes. And I thought maybe there is possibility to push ArrayList to chart to instantly draw a chart. And after this to draw it normally, adding points in periods of time. I don't know, maybe my way of thinking on this is wrong.

from live-chart.

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.