Coder Social home page Coder Social logo

update() API to update data about cal-heatmap HOT 5 CLOSED

wa0x6e avatar wa0x6e commented on May 18, 2024
update() API to update data

from cal-heatmap.

Comments (5)

SirDerpington avatar SirDerpington commented on May 18, 2024

Is there any kind of workaround till 3.1 is ready to use?

I just tried a workaround but it's really dirty. It works but I don't know much about svgs...

http://jsfiddle.net/SirDerpington/5Hkud/1/

Basically I just reinsert all initial settings und play a bit with the widths of each svg. I coulnd't figure out how or when I should reset the width of the .graph svg so i just put a overflow: hidden; on the itemSelector div. Otherwise a horizontal scrollbar would appear.

var domains = $('.graph').children('svg');
var width = Number(domains.first().attr('width'));
var x = 0;
domains.each(function () {
    $(this).attr('x', x);
     x += width;
 });
 $('.graph-legend').attr('width', x);

I know..not really smart but it works. Is there maybe another possible, easier solution?

from cal-heatmap.

wa0x6e avatar wa0x6e commented on May 18, 2024

You seems to be missing the point of the update() feature.

update() will be used to update a date, to change that date associated value, so the cell on the calendar will eventually change color.

What you're trying to do is moving cells around, and not related to update().
What feature are you looking for ?

from cal-heatmap.

SirDerpington avatar SirDerpington commented on May 18, 2024

Oh well...I indeed missunderstood the update() feature. I just read the title "...to update data"

What I'm looking for is to dynamically change the data which sould be showed.
Let's say I have a table on my page. It displays a list of users and their transactions on a daily basis. On page load the graph shows the transactions per day for all users. (so if each of e.g. 10 users made 10 transactions on a day the graph shows 100 transactions for this day)

But in my table I have an option like a select dropdown where you can choose a user to only show his transactions. After choosing a specific user it should only show the graph with his transactions. Therefore I would do an ajax call and afterwards exchange the data source of the CalHeatMap.
See this jsfiddle http://jsfiddle.net/SirDerpington/5Hkud/. (same example as above but without my "workaround")

But I couldn't find much about updating the data source dynamically. I hope my desired feature is clear now.

from cal-heatmap.

wa0x6e avatar wa0x6e commented on May 18, 2024

I see now, what you're seeking is exactly what the update() API is intended for: dynamically change the content of the calendar.

ETA for this feature is before monday.

from cal-heatmap.

SirDerpington avatar SirDerpington commented on May 18, 2024

Perfect! Looking forward to this feature.

from cal-heatmap.

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.