Code Monkey home page Code Monkey logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
added in trunk, though it requires you to set up your own post-processing 
functions
to get the returned data into shape.

Original comment by [email protected] on 27 Apr 2008 at 9:15

  • Changed state: Fixed

from timemap.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
I got the example on "basic usage" to work.  Yea!  I also succeeded putting 
that 
data in a separate file, "basic_data.js", and using <script> to preload the 
object 
and put it in 'value' (e.g. load a file with var items={...}, then I used value:
[items] in the onLoad).  Crude, but a little closer to what I wanted.

I gather from looking through timemap.js, that I should be able to do this by 
type:"json", url:"basic_data.js", but this doesn't work.  Ideas?  Is this 
related 
to "set up your own post-processing", or some other newbie mistake?

Original comment by [email protected] on 16 Sep 2008 at 1:41

from timemap.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
I hope to add a wiki page detailing this soon, but here's the quick rundown:

- If you're using your own static data, it's perfectly fine to do exactly what 
you
did: load your data manually into a variable, use the "basic" type and set the 
value
to the name of your variable (though you probably want your variable to be a 
array,
e.g. items = [{...item 1 data...}, {...item 2 data...}]). The effect is exactly 
the
same as using the JSON loader.

- The main point of the JSON loader is if you're loading data from someone 
else's
service - for example, exporting events from a Google Calendar or a Google
Spreadsheet. These services often work by creating the data on the fly in JSON
format; rather than assigning the data to a variable, though, they use it as the
argument for a callback function with a name you provide. This is what the JSON
loader helps with - if you give it the URL of the JSON-providing service, 
leaving off
the name of the callback function (e.g.
"http://www.example.com/somedata.php?mycallbackfunction="), the JSON loader will
create a function name and handle the data once it's returned.

So while it's possible to use the JSON loader in the way that you'd like, by 
spoofing
the callback function (not worth going into the details here), it's actually 
much
simpler and easier, if you control the data, to just do what you did, load it 
into a
variable and use the "basic" loading mechanism. This is actually more stable as 
well,
because you don't have to deal with any asynchronous loading procedure, as the 
data
is already loaded when you set it to TimeMap.

hope that helps -

Original comment by [email protected] on 16 Sep 2008 at 4:15

from timemap.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
Cool, I understand the thinking more.  That is a great help!

Original comment by [email protected] on 16 Sep 2008 at 4:41

from timemap.

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.