Not sure that you are interested with that but with the implementation of ChartJs i have done for seaside:

stefExample: html
| b chartData |
b := Bag new.
b add: 1 withOccurrences: 5.
b add: 3 withOccurrences: 4.
b add: 6.
chartData := Chart2dData xObjects: (1 to: 6) function: [ :aValue | b valuesAndCounts at: aValue ifAbsent: 0 ].
chartData chartType: ChartBar.
html render: (ChartJsComponent data: chartData)

Images intégrées 1

2016-02-15 17:11 GMT+01:00 stepharo <stepharo@free.fr>:
Thanks vincent but how can I get a real histogram?
with empty columns for empty values?

Le 15/2/16 16:00, Blondeau Vincent a écrit :

If you want to use the last version:

     b := Bag new.

    b add: 1 withOccurrences: 5.

     b add: 3 withOccurrences: 4.

     b add: 6.

     b.

 

    v := RTGrapher new.

    ds:=RTData new.

    ds interaction popup.

    ds points: b valuesAndCounts keys.

    ds y:[:c|b valuesAndCounts at: c].

    ds barShape color: Color red; width: 15.

    v add: ds.

    v axisX.

    v axisYWithNumberOfTicks: 3.

    v build.

    v open

 

But, the abscissa labels are not accurate:

 

Vincent

 

De : moose-dev-bounces@list.inf.unibe.ch [mailto:moose-dev-bounces@list.inf.unibe.ch] De la part de Brice GOVIN
Envoyé : lundi 15 février 2016 15:54
À : Moose-related development
Objet : [Moose-dev] Re: How to display an histogram given a bag

 

You can try something like that:



     b := Bag new.
     b add: 1 withOccurrences: 5.
     b add: 3 withOccurrences: 4.
     b add: 6.
     b.

    v := RTDoubleGraphBuilder new.
    ds:=RTStackedDataSet new.
    ds interaction popup.
    ds points: b valuesAndCounts keys.
    ds y:[:c|cb valuesAndCounts at: c].
    ds barShape color: Color red; width: 15.
    v add: ds.
    v axisX.
    v axisYWithNumberOfTicks: 5.
    v open

I'm working with an old version of Roassal (version 761 of the Roassal package) then I don't know if it's working with a more recent version.

Otherwise there is examples in the Grapher Menu of the Roassal examples.

 

Regards,

 

--------------
Brice Govin
PhD student in RMoD research team at INRIA Lille
Software Engineer at THALES AIR SYSTEMS Rungis
ENSTA-Bretagne ENSI2014
22 Avenue du General Leclerc 92340 BOURG-LA-REINE


________________________________________
De : moose-dev-bounces@list.inf.unibe.ch <moose-dev-bounces@list.inf.unibe.ch> de la part de stepharo <stepharo@free.fr>
Envoyé : lundi 15 février 2016 15:22
À : Moose-related development
Objet : [Moose-dev] How to display an histogram given a bag

Hi

I have a bag

     b := Bag new.
     b add: 1 withOccurrences: 5.
     b add: 3 withOccurrences: 4.
     b add: 6.
     b

and I would like to display it as an histogram with roassal.

Stef
_______________________________________________
Moose-dev mailing list
Moose-dev@list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev




Ce message et les pièces jointes sont confidentiels et réservés à l'usage exclusif de ses destinataires. Il peut également être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant être assurée sur Internet, la responsabilité de Worldline ne pourra être recherchée quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne saurait être recherchée pour tout dommage résultant d'un virus transmis.

This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Worldline liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.


_______________________________________________
Moose-dev mailing list
Moose-dev@list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
Moose-dev@list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev




--
Guillaume Larcheveque