Salut tout le monde , je veut utiliser le plugin “acts_as_node” pour
dessiner des graphs dans mon application pour cela j’ai suivi un tuto
sur le site :
ce plugin pour l’éxploiter il y’a plusieurs paramétre à identifier ':
* class_name. The model name of the root of the graph.
(Eg. :ProductCategory)
* root_id. The id of root instance that will generate the graph
(Eg: 1)
There is a long list of optional_parameters, that I’ll describe here:
* depth. The depth of the graph involved, counting from the root
node.
* layout. This enable us to set which layout we want to render the
graph. The available options are: :SnowflakeLayout
& :ForceDirectedLayout.
* content. The DOM elment’s id that will contain the drawing. If
this value is not set, it will be add to document.body object.
* childRadius. The lenght of the edge between nodes
* fanAngle. The angle between silbling nodes, applies only for the
Snowflake layout.
* mass. This value represents the mass of each node for the
algorithm, it is used to calculate the forces & the separation between
the nodes, applies only for ForceDirected layout (default value: 0.3)
* children_accesors. This is an important parameter, it indicates
which methods of the model we will invoked to inspect for children
nodes. It MUST be defined as a hash like the following:
{ :ProductCategory => [:children, :compaines] }. In this example, the
graph_drawing helper will inspect the children’s and companies’s
collections of the ProductCategory instances that the algorithm
reaches.
* children_fields. This enables the algorithm to set the
appropiate title, content & picture attributes of the nodes. For
example, in the followin definition for children_fields =>
{ :ProductCategory => { :title => :name, :content
=> :description, :picture => :picture_uri}, the graph_drawing helper
will render all ProductCategory nodes with a tooltip that contains a
title assosiated with the name field of the instance, the content of
the tooltip will be the value of description field of the instance,
and the node itself will be rendered with the image provided by the
picture_uri field.
* image_width. This parameter enables you to set the width of the
image for the pictures of the nodes.
* image_height. Likewise The same concept of image_width related
to the height of the pictures.
mais j’ai pas compris ‘children_accesors’ et ‘children_fields’
-moi j’ai un tableau qui contient 2 champs => projet et nombre de
tache , je veut savoir comment utilisé ses 2 paramétres pour dessiner
un graph qui représente les projets on fonction de nombre des taches