vasturiano / timelines-chart

Timelines Chart
http://vasturiano.github.io/timelines-chart/example/categorical/
MIT License
563 stars 122 forks source link

Fresh API not works #42

Closed eleinwang closed 4 years ago

eleinwang commented 5 years ago

Hi , Firstly thanks for this excellent module . I have a project using this module . But due it doesn't support filtering by keywords , I am ready to re-render chart with new data instead . However , when I use refresh API to re-render , it seems not works . Could you help to check it ? I wander if it's source code issue or something wrong with my using way . Br , Jing

Foxtra commented 5 years ago

@eleinwang the refresh function works fine for me. Here is an example how I use it: ... <body> <div id="buttons-div"> <input class="button" type="button" value="Show first data" onclick="btnClicked(0)"> <input class="button" type="button" value="Show second data" onclick="btnClicked(1)"> </div>

<div id="timeline-chart-div"> //just empty div-container for chart </div>

<script> var myData = []; const timeline = TimelinesChart(); timeline //.here your customize parameters .data(myData) //initially empty (document.getElementById("timeline-chart-div")); //location of chart

function btnClicked(select) { //we clicked one of buttons myData = getData(select);//and get the data from here timeline //it is our chart .data(myData)//new data .refresh(); //and refresh it :) } </script> </body> ...