0

Actually im trying this:

public static DefaultCategoryDataset dataset = new DefaultCategoryDataset();;

    public void atualizaDataset(int humano, int zumbi, int rodada){
        final String series1 = "Humano";
        final String series2 = "Zumbi";

        dataset.addValue(humano, series1, (Comparable)rodada);
        dataset.addValue(zumbi, series2, (Comparable)rodada);
    }

and in the main

public Grafico g = new Grafico("Grafico");

    public void verGrafico(){
        g.atualizaDataset(qtdHumanos, qtdZumbis, nroJogada);
        g.pack();
        g.setVisible(true);
        g.repaint();
    }

but when i send the values to ´atualizaDataset´ he add them to the graphic but do not save this dataset to concatenate with the new values that are coming..

GGirotto
  • 848
  • 2
  • 10
  • 31
  • You could always call `setValue` on the `DefaultCategoryDataset`. But maybe you should add further information. Did you deliberately choose a `CategoryDataSet`? Wouldn't a `XYSeries` be more appropriate? What kind of data do you want to display? Just something as simple as the contents of some `double[]` array or so? – Marco13 Nov 26 '15 at 21:18
  • Its a graphic that shows the number of humans and zombies alive by the course of plays (its a simulator, zombies kill humans sometimes) so every round that a zombie kill a human the number of humans in the graphic decrease 1. – GGirotto Nov 26 '15 at 21:26
  • I was reading about this XYSeries and its really interesting. But how do i update the graphic data? It looks like that the data of the graphic its pre-defined – GGirotto Nov 26 '15 at 21:43
  • If you can't change something after creation, you can always replace it with a new instance... – Durandal Nov 26 '15 at 22:53
  • 1
    Possible duplicate of [this](http://stackoverflow.com/q/21260302/230513) or [this](http://stackoverflow.com/q/15460355/230513). If not, please edit your question to include a [mcve] that shows your current approach. – trashgod Nov 27 '15 at 04:53

0 Answers0