PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HBERGEURS DEVIS FORUMS RDUCTEUR D'URL
Prcdent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > scruffy question
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
scruffy question

Rponse
 
LinkBack Outils de la discussion
Vieux 05/11/2007, 11h50   #1
remco.zwaan@gmail.com
Aucun Avatar
 
Messages: n/a
Hbergeur:
Par dfaut scruffy question

Hi

installed scruffy...and put the code below in my controller.

def show_img
graph = Scruffy::Graph.new
graph.title = "Comparative Agent Performance"
graph.value_formatter =
Scruffy::Formatters::Percentage.new(:precision => 0)

graph.add :stacked do |stacked|
stacked.add :bar, 'remco', [30, 60, 49, 29, 100, 120]
stacked.add :bar, 'peter', [120, 240, 0, 100, 140, 20]
stacked.add :bar, 'femmie', [10, 10, 90, 20, 40, 10]
end

graph.point_markers = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']

send_data(graph.render(:width => 800, :as => 'PNG'), :type =>
'image/png', :disposition=> 'inline')
end


In the view a placed...

<img src="<%= url_for(:action => 'show_img') %>"/>

But with no succes..

In the generated HTML i get

<img src="/users/show_img"/>


What i am doing wrong???

remco
--
Posted via http://www.ruby-forum.com/.

  Rponse avec citation
Vieux 07/11/2007, 08h14   #2
Jacob Basham
Aucun Avatar
 
Messages: n/a
Hbergeur:
Par dfaut Re: scruffy question

I'm not familiar with what you are doing, but I'm pretty sure you need
to save the file in a public directory. Save that path as a variable
which you can use in the view.

And on a side note, url_for(:action) just builds the relative path for
the page show_img creates. url_for is for building relative links to
other controllers and actions. These paths are not real paths in your
public directory, they are virtual paths rails builds for you when you
request them.

The rails list would be your best bet for more in depth .

Jake

On Nov 5, 2007, at 5:50 AM, Remco Swoany wrote:

> Hi
>
> installed scruffy...and put the code below in my controller.
>
> def show_img
> graph = Scruffy::Graph.new
> graph.title = "Comparative Agent Performance"
> graph.value_formatter =
> Scruffy::Formatters::Percentage.new(:precision => 0)
>
> graph.add :stacked do |stacked|
> stacked.add :bar, 'remco', [30, 60, 49, 29, 100, 120]
> stacked.add :bar, 'peter', [120, 240, 0, 100, 140, 20]
> stacked.add :bar, 'femmie', [10, 10, 90, 20, 40, 10]
> end
>
> graph.point_markers = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']
>
> send_data(graph.render(:width => 800, :as => 'PNG'), :type =>
> 'image/png', :disposition=> 'inline')
> end
>
>
> In the view a placed...
>
> <img src="<%= url_for(:action => 'show_img') %>"/>
>
> But with no succes..
>
> In the generated HTML i get
>
> <img src="/users/show_img"/>
>
>
> What i am doing wrong???
>
> remco
> --
> Posted via http://www.ruby-forum.com/.
>



  Rponse avec citation
Vieux 13/12/2007, 17h15   #3
Got Got
Aucun Avatar
 
Messages: n/a
Hbergeur:
Par dfaut Re: scruffy question

Hi,

I have tested with :
send_data(graph.render(:width => 800, :as => 'PNG', :to =>
"#{RAILS_ROOT}" + "/public/images/test.png"), :type =>'image/png',
:disposition => 'inline')

instead of :
send_data(graph.render(:width => 800, :as => 'PNG'), :type =>
'image/png', :disposition=> 'inline')

But i have the same problem :
app/controllers/supports_controller.rb:88: syntax error, unexpected
tSTRING_BEG, expecting $end
end',gfd :disposition=> 'inline')
^

I can't understand !!!

Who can me to use Scruffy with RoR ?

Got
--
Posted via http://www.ruby-forum.com/.

  Rponse avec citation
Vieux 27/12/2007, 11h49   #4
-- Got
Aucun Avatar
 
Messages: n/a
Hbergeur:
Par dfaut Re: scruffy question

Hi,

Finally, I'm trying to test Scruffy in my 'application_er.rb' :

def render_scruffy_graph
graph = Scruffy::Graph.new
graph.title = "Comparative Agent Performance"
graph.value_formatter =
Scruffy::Formatters::Percentage.new(:precision => 0)
graph.add :stacked do |stacked|
stacked.add :bar, 'remco', [30, 60, 49, 29, 100, 120]
stacked.add :bar, 'peter', [120, 240, 0, 100, 140, 20]
stacked.add :bar, 'femmie', [10, 10, 90, 20, 40, 10]
end
graph.point_markers = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']
graph.render(:width => 800, :as => 'PNG')
end

with :
<%= render_scruffy_graph %> #in my 'show.rhtml' file

But the image is returned as blob/string.

So I've got something like that :
>ϟ?�իW�k�.,[� ~��g��GD���VkD� AdM`` Ə�~��B�V�M{��M���[ؿ���&��j� �'OFŊ�n��u��5����RŊÍסR ��5k4T���S�xN!��ᨔ�(=�� ���W_aʔ?���… c��}(V��Ŷ cǎU��D� q 9�ڵk�ܹ�8p@���(]:۷oC�޽�.:I`ժ�زe3ʕ+�tQ1h�@�� �T* 4P�9g����0aF��t8�|��V p����GD�өR� ��� OOO�I]"�/_�U�V����x��9���P�\9�� ��7y��1�m޼>��,���n�E ܸqŋ�̟��C� �ܹseʔ�(���xV�G�... D�-��7d�����hT�P>T:,��[�n� �ׯ��ѣrHHH@\\��E$�\� r*���8s� ��J�nݺ�=z����6�)S�46oނ% .�n޼��+rLH�� �Z�–-���=B��ep��5,X�жm;�ܹS�b* J�Hj ��L�cǎŏ?��tX����Qp ss��)S�o�Q�HDDP Hz!.ΰ|��(S�#44-[������s�� t{�5���R�


How can I show my picture ?
Thx
Got
--
Posted via http://www.ruby-forum.com/.

  Rponse avec citation
Rponse


Outils de la discussion

Rgles de messages
Vous ne pouvez pas crer de nouvelles discussions
Vous ne pouvez pas envoyer des rponses
Vous ne pouvez pas envoyer des pices jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont actives : oui
Les smileys sont activs : oui
La balise [IMG] est active : oui
Le code HTML peut tre employ : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 12h26.


dit par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits rservs.
Version franaise #16 par l'association vBulletin francophone
PHWinfo est un site ducation Sans Frontires 2000-2008
Ad Management by RedTyger
©Tous droits rservs par les parties respectives
Page generated in 0,15695 seconds with 12 queries