misoproject / dataset

JavaScript library that makes managing the data behind client-side visualisations easy
http://misoproject.com
GNU General Public License v2.0
1.18k stars 99 forks source link

How do I get started with Dataset? #206

Open nunon opened 11 years ago

nunon commented 11 years ago

Hello,

I've followed the instructions as in http://misoproject.com/dataset/tutorials/quickstart and downloaded the development files locally.

However, all I get is a blank page...

Heres the code I'm using:

<!DOCTYPE HTML>

Your Application Title

And in teste.js: var data = [ { color : "red", r : 255, g : 0, b : 0 }, { color : "blue", r : 0, g : 0, b : 255 }, { color : "green", r : 0, g : 255, b : 0 } ];

var ds = new Miso.Dataset({ data : data });

ds.fetch({ success : function() { log("Dataset Ready. Columns: " + this.columnNames()); log("There are " + this.length + " rows"); log("Available Colors: " + this.column("color").data); } });

Can someone please explain me what I'm doing wrong? This seems a fantastic library and I'd really like to explore it.

Thanks in advance for any help.

eepstein commented 11 years ago

Want to put up a plnkr to show your code.

Is this in an html file that is pulling in the miso code?

Also, you are logging things - perhaps you want console.log() rather than just log() - so nothing will show in the page - open the console and take a look that way. Chrome is the browser I use for that.

nunon commented 11 years ago

Hi,

Sorry, I don't know what a plnkr is ;) I have 2 files: an HTML and a Js file, exactly as in http://misoproject.com/dataset/tutorials/quickstart I changed the log to console.log but nothing changed, I still get blank pages. Thanks for your help!

eepstein commented 11 years ago

Google is your friend. Don;t know what something is? Search for it. http://plnkr.co/ Do you know how HTML works? You're not emitting any markup so of course the page is blank. Most browsers have some sort of dev tools. Within that there is usually a JavaScript console. That's where you'll find log messages. In Chrome on a Mac it's under View > Developer > JavaScript Console.

IF you want to show values via HTML you need some JavaScript <-> HTML framework. There are scads and scads of them: Dojo, jQuery, etc. Personally I opt for Angular and recommend it.

eepstein commented 11 years ago

Your questions isn't about Miso.Dataset. It's about JavaScript and HTML. There are many sites on the web to help you with those and many more, like StackOverflow, to answer these more general questions.

nunon commented 11 years ago

Hi, Thanks for your explanation. The plunker I'm using is in http://plnkr.co/edit/YXDYSO?p=preview The HTML isn't outputing anything directly but it contains a reference to teste.js that should log messages to the browser in case the dataset had been created. The erors I get in my js file are: ReferenceError: _ is not defined @ file:///.../development/miso.ds.0.3.0.js:758 TypeError: this._initialize is not a function @ file:///.../development/miso.ds.0.3.0.js:54

eepstein commented 11 years ago

So, first thing is that when developing it is recommended one not use the minimized (.min) version of libraries. Libraries are minimized to speed download when you deploy your "production" website, but they make debugging very challenging.

So, in your plunkr, rename teste.html to index.html. Also you can put the two script tags in the head element (or you can leave them in the body).

Take a look: http://plnkr.co/edit/RWAS3x

nunon commented 11 years ago

Ok, I made the changes to the HTML and changed the reference to the library to a production environment.

I still get the same errors: miso.ds.0.4.1.js (linha 54) ReferenceError: _ is not defined this._initialize(options);

miso.ds.0.4.1.js (linha 54) TypeError: this._initialize is not a function this._initialize(options);

You may see the plunkr at: http://plnkr.co/edit/YXDYSO?p=preview

I also tested my own script (teste.js) and it's running.

eepstein commented 11 years ago

You are using the wrong miso javascript. The one you are referencing is PURE miso without Miso's dependencies. Miso depends on a bunch of other packages, including underscore.js, among others. Miso ships various flavors: minimized / non-minimized (as mentioned before), with dependencies / without dependencies. So there are 4 flavors just between those options. This is very common with JS libraries. So reference the correct Miso and try again. See the plnkr I forked from yours. Take a look. It works. See what's different.

miguelpaz commented 11 years ago

Note aside: Its so much fun to read this back and forth communication :) El 16/07/2013 13:42, "eepstein" notifications@github.com escribió:

You are using the wrong miso javascript. The one you are referencing is PURE miso without Miso's dependencies. Miso depends on a bunch of other packages, including underscore.js, among others. Miso ships various flavors: minimized / non-minimized (as mentioned before), with dependencies / without dependencies. So there are 4 flavors just between those options. This is very common with JS libraries. So reference the correct Miso and try again. See the plnkr I forked from yours. Take a look. It works. See what's different.

— Reply to this email directly or view it on GitHubhttps://github.com/misoproject/dataset/issues/206#issuecomment-21059211 .