No, when you request the URL, it's supposed to return a CSV file. You provide the URL to D3, and it makes an Ajax request to the URL in order to retrieve the CSV file. See https://github.com/mbostock/d3/wiki/CSV. Looks like you can also pass a CSV string to D3.csv.parse(), so you might be able to just include the CSV content hidden in the HTML and extract the text node and pass it to D3. You might also consider using JSON, which will save D3 the trouble of parsing CSV.
Anthony On Monday, June 24, 2013 5:04:06 PM UTC-4, greaneym wrote: > > Hi, > > I tried the @service.csv example in the book and it does return values, > but they are not in the form of a url but a download. I wonder if this is > the expected behavior? I am using mac os. > When I enter the path to the url including values, the system immediately > returns the downloads interface and presents a file. From reading the > manual, it looks like the service is supposed to render the values as a > url? > > > all I did was copy and paste the example into the default.py controller > and run the suggested call to the service. > What am I doing wrong? thanks > > > On Monday, June 24, 2013 3:12:15 PM UTC-5, Anthony wrote: >> >> Do you want to embed the data in the page, or do you want to serve it as >> a CSV file? If you want to embed it in the page, you might need to embed it >> in some Javascript as a Javascript data structure rather than as pure HTML. >> To serve a CSV file, see >> http://web2py.com/books/default/chapter/29/10#CSV (you might be able to >> set the content type to 'text/csv' rather than what is shown in that >> example). You would then provide D3 with the URL that serves the CSV file >> (note, it doesn't actually generate a CSV file on the server -- it just >> uses a cStringIO object and sends its content as the HTTP response). >> >> Anthony >> >> >>> -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

