IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

2D Java Discussion :

JFreeCharts - impossible de lancer la moindre applicaiton


Sujet :

2D Java

  1. #1
    Membre du Club
    Profil pro
    Developpeur
    Inscrit en
    Septembre 2004
    Messages
    114
    Détails du profil
    Informations personnelles :
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Developpeur

    Informations forums :
    Inscription : Septembre 2004
    Messages : 114
    Points : 43
    Points
    43
    Par défaut JFreeCharts - impossible de lancer la moindre applicaiton
    Bonjour,

    Je viens ici pour trouver de l'aide car je me suis intéressé à JFreeCharts afin de pouvoir généré un graphique à barre horizontal mais scindé en plusieurs morceaux.

    Déjà trouver le bon modèle n'est pas évident mais cela n'est pas le but de ma discussion.

    J'ai téléchargé l'api et importer les jar : jcommon-1.0.15.jar et jfreecharts-1.0.12.jar.

    Lorsque je tape une application toute faite sur le net comme celle-ci :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
     
    package vue;
     
    import java.awt.Color;
    import java.awt.Font;
    import java.text.DecimalFormat;
     
    import org.jfree.chart.ChartFrame;
    import org.jfree.chart.JFreeChart;
    import org.jfree.chart.axis.CategoryAxis;
    import org.jfree.chart.axis.NumberAxis;
    import org.jfree.chart.axis.NumberTickUnit;
    import org.jfree.chart.labels.ItemLabelAnchor;
    import org.jfree.chart.labels.ItemLabelPosition;
    import org.jfree.chart.plot.CategoryPlot;
    import org.jfree.chart.plot.PlotOrientation;
    import org.jfree.chart.renderer.category.IntervalBarRenderer;
    import org.jfree.data.category.DefaultIntervalCategoryDataset;
    import org.jfree.ui.TextAnchor;
     
    /**
     * An interval bar chart.
     *
     * @author Jeremy Bowman
     */
    public class IntervalBarChartsDemo1 {
     
        /** The categories. */
        private static final String[] CATEGORIES = {"1", "3", "5", "10", "20"};
     
        /** The label font. */
        private static Font labelFont = null;
     
        /** The title font. */
        private static Font titleFont = null;
     
        /** The chart. */
        private JFreeChart chart = null;
     
        static {
            labelFont = new Font("Helvetica", Font.PLAIN, 10);
            titleFont = new Font("Helvetica", Font.BOLD, 14);
        }
     
        /**
         * Creates a new demo.
         */
        public IntervalBarChartsDemo1() {
     
            DefaultIntervalCategoryDataset data = null;
            final double[][] lows = {{-.0315, .0159, .0306, .0453, .0557}};
            final double[][] highs = {{.1931, .1457, .1310, .1163, .1059}};
            data = new DefaultIntervalCategoryDataset(lows, highs);
            data.setCategoryKeys(CATEGORIES);
     
            final String title = "Strategie Sicherheit";
            final String xTitle = "Zeitraum (in Jahren)";
            final String yTitle = "Performance";
            final CategoryAxis xAxis = new CategoryAxis(xTitle);
            xAxis.setLabelFont(titleFont);
            xAxis.setTickLabelFont(labelFont);
            xAxis.setTickMarksVisible(false);
            final NumberAxis yAxis = new NumberAxis(yTitle);
            yAxis.setLabelFont(titleFont);
            yAxis.setTickLabelFont(labelFont);
            yAxis.setRange(-0.2, 0.40);
            final DecimalFormat formatter = new DecimalFormat("0.##%");
            yAxis.setTickUnit(new NumberTickUnit(0.05, formatter));
     
            final IntervalBarRenderer renderer = new IntervalBarRenderer();
            renderer.setSeriesPaint(0, new Color(51, 102, 153));
    //        renderer.setLabelGenerator(new IntervalCategoryLabelGenerator());
            renderer.setItemLabelsVisible(true);
            renderer.setItemLabelPaint(Color.white);
            final ItemLabelPosition p = new ItemLabelPosition(
                ItemLabelAnchor.CENTER, TextAnchor.CENTER
            );
            renderer.setPositiveItemLabelPosition(p);
     
            final CategoryPlot plot = new CategoryPlot(data, xAxis, yAxis, renderer);
            plot.setBackgroundPaint(Color.lightGray);
            plot.setOutlinePaint(Color.white);
            plot.setOrientation(PlotOrientation.VERTICAL);
     
            this.chart = new JFreeChart(title, titleFont, plot, false);
            this.chart.setBackgroundPaint(Color.white);
        }
     
        // ****************************************************************************
        // * JFREECHART DEVELOPER GUIDE                                               *
        // * The JFreeChart Developer Guide, written by David Gilbert, is available   *
        // * to purchase from Object Refinery Limited:                                *
        // *                                                                          *
        // * http://www.object-refinery.com/jfreechart/guide.html                     *
        // *                                                                          *
        // * Sales are used to provide funding for the JFreeChart project - please    * 
        // * support us so that we can continue developing free software.             *
        // ****************************************************************************
     
        /**
         * Returns the chart.
         *
         * @return the chart.
         */
        public JFreeChart getChart() {
            return this.chart;
        }
     
        /**
         * Starting point for the demo.
         *
         * @param args  ignored.
         */
        public static void main(final String[] args) {
            final IntervalBarChartsDemo1 sample = new IntervalBarChartsDemo1();
            final JFreeChart chart = sample.getChart();
            final ChartFrame frame = new ChartFrame("Interval Bar Chart Demo", chart);
            frame.pack();
            frame.setVisible(true);
        }
    }
    Lorsque je fais RunAS Java Application, rien ne se passe aucune fenêtre ne s'ouvre ni même de console.

    Ai-je oublier quelque chose ?

    Merci d'avance pour votre aide

  2. #2
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 481
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 481
    Points : 48 806
    Points
    48 806
    Par défaut
    affiche la console sous eclipse et dit nous ce qui se passe dedans. T'as surement une exception qui se déclenche. Affiche aussi la "liste des problèmes" dans les vue eclipse. Tant qu'il y aura des error le code ne compilera pas et ne se lancera pas.

Discussions similaires

  1. Impossible de lancer le moindre example
    Par Fylen dans le forum Ogre
    Réponses: 6
    Dernier message: 03/02/2009, 10h37
  2. [RMI] Impossible de lancer mon serveur
    Par Dahu dans le forum API standards et tierces
    Réponses: 11
    Dernier message: 11/06/2006, 10h17
  3. [Install]Impossible de lancer eclipse
    Par kaishef dans le forum Eclipse Java
    Réponses: 1
    Dernier message: 10/05/2005, 11h02
  4. [Plugin Tomcat] Impossible de lancer TOMCAT
    Par Dahu dans le forum Eclipse Java
    Réponses: 7
    Dernier message: 03/03/2005, 11h40
  5. impossible de lancer xmlrad
    Par hachach dans le forum XMLRAD
    Réponses: 3
    Dernier message: 07/09/2004, 17h52

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo