Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using jQuery to change the Data Attribute #28

Open
damiansmith86 opened this issue Sep 27, 2013 · 3 comments
Open

Using jQuery to change the Data Attribute #28

damiansmith86 opened this issue Sep 27, 2013 · 3 comments

Comments

@damiansmith86
Copy link

I added some script to my test area that would use jQuery attr() to update the data-oochart-start-date:

<ul>
<li><a href="#" id="today">View Todays</a></li>
<li><a href="#" id="week">View Past 7 Days</a></li>
<li><a href="#" id="month">View Past Month</a></li>
<li><a href="#" id="year">View Past Year</a></li>
</ul>

<div class="output" data-oochart='timeline' data-oochart-start-date='7d' data-oochart-metrics='ga:visits,Visits,ga:visitBounceRate,Bounces' data-oochart-dimension='ga:visitLength' data-oochart-profile='0000000'></div>

$(document).ready(function(){
$('#today').click(function() {
    $('.output').attr('data-oochart-start-date', '1d');
});
});

It changes the data attribute without issue, but the graphs do not "regenerate"
Basically remain static.

Is there a feature for this that I have missed, or can anyone produce a better method for this?

Thanks!

@tshaddix
Copy link
Owner

Hey @damiansmith86, the method that draws the charts based on the DOM elements is only run on the initial start of the script. I will turn this into a feature request to expose that method so you can call something like drawHTMLCharts() or something like that.

@ghost ghost assigned tshaddix Sep 30, 2013
@damiansmith86
Copy link
Author

That sounds perfect, I would like to have spent the time thinking up something myself but would take me months and months with my workflow!

@tshaddix
Copy link
Owner

tshaddix commented Oct 3, 2013

@damiansmith86 Well I might not be too speedy either, just a warning ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants