Problem with chart types with Angular & DataViz

98 views
Skip to first unread message

Doug Thompson

unread,
Feb 29, 2016, 4:59:06 PM2/29/16
to Keen IO Community
I'm having an issue with defining chart types using Dataviz.
I have an Angular application and I'm sure it might be a dependency of some kind I'm missing or something obvious. However, when I run the following I get a "Count" style display correctly:

Keen.ready(function(){
 
 
var chart = new Keen.Dataviz()
 
.el(document.getElementById("chart-wrapper"))
 
.height(500)
 
.prepare();


 
var req = client.run(query, function(err, res){
 
if (err) {
    chart
.error(err.message);
 
}
 
else {
    chart
     
.data(res)
     
.title('New Customers per Week')
     
.render();
 
}
 
 
});
 
});

The above displays as:



However, when I add:

.type('barchart')

As:

var chart = new Keen.Dataviz()
.el(document.getElementById("chart-wrapper"))
.height(500)
.type('barchart')
 
.prepare();



It throws an error:

TypeError: (intermediate value).el(...).height(...).type is not a function

Am I missing something obvious? 

Dustin Larimer

unread,
Feb 29, 2016, 5:03:15 PM2/29/16
to Doug Thompson, Keen IO Community
Hey, Doug- if you're using keen-js, try using `chartType()` instead of "type". This naming is changing in the new standalone SDK, but hasn't been rolled into keen-js yet. Let me know if that helps!

Doug Thompson

unread,
Feb 29, 2016, 5:06:48 PM2/29/16
to Keen IO Community, do...@dot-3.net
Ah indeed it helps....although now in the view I get "Incorrect chartType" although I didn't have problems with this chart type when running a repo in "plain" JS.

Which repository or documentation should I reference for chart types?

(P.S. Thanks for the assistance!!!)

Doug Thompson

unread,
Feb 29, 2016, 5:26:06 PM2/29/16
to Keen IO Community, do...@dot-3.net
Apologies - I transposed incorrectly.

It was a "linechart" and I copied over "columnchart".

Working great, thanks, and love seeing it work in Angular!!!

Best.


On Monday, 29 February 2016 17:03:15 UTC-5, dustin wrote:
Reply all
Reply to author
Forward
0 new messages