Giter Club home page Giter Club logo

Comments (3)

erdogant avatar erdogant commented on May 13, 2024

Thank you for posting your issue and clear explanation.

First of all, there was an issue with the datetime format that I fixed. Secondly the timedelta was shown in hours but should have been in minutes. I also fixed this! The parameter timedelta can now be changed in minutes, hours and days. Otherwise it can take a lot of time for the simulation when a long timespan is used. The default is minutes and now the movements in movingbubbles with your data seem to be correct now! But also check it again. I noticed in your query that no datetime format was specified. This is important because the default is different.

Update to the latest version with:
pip install -U d3blocks

Example:

 
df = pd.read_csv(r'C:\temp\test_AL.csv')

# Notes that are shown between two time points.
time_notes = [{"start_minute": 1, "stop_minute": 10, "note": "The first 10 minutes start in the state Regarder la TV."}]
time_notes.append({"start_minute": 11, "stop_minute": 360, "note": "Then we stay in this state up to 12:00"})
time_notes.append({"start_minute": 361, "stop_minute": 390, "note": "Finally the Consulter de l actualite happens and is up to 13:30."})
time_notes.append({"start_minute": 391 , "stop_minute": 450, "note": "aaaand we go back to the first state.."})

from d3blocks import D3Blocks

d3 = D3Blocks()

d3.movingbubbles(df,
                 standardize=None,
                 dt_format='%Y-%m-%d %H:%M:%S',
                 time_notes=time_notes,
                 title='d3blocks_movingbubbles',
                 speed={"slow": 1000,
                        "medium": 200,
                        "fast": 20},
                 )

# Check the movements
print(d3.edge_properties)

# If you want to specify the time_notes, best is to use the cumsum of the time in the state.
d3.edge_properties['time_in_state'].cumsum()

from d3blocks.

erdogant avatar erdogant commented on May 13, 2024

The percentage stil needs a fix. I just realized this. This is computed in javascript itself and not python. Each block has its own set of js functions. For movingbubbles it is movingbubbles.html.j2

// Output readable percent based on count.
function readablePercent(n) {

var pct = 100 * n / 1000;
if (pct < 1 && pct > 0) {
	pct = "<1%";
} else {
	pct = Math.round(pct) + "%";
}

return pct;

}

from d3blocks.

erdogant avatar erdogant commented on May 13, 2024

I fixed this issue too now in v1.2.6!

from d3blocks.

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.