title: How to get diamond shape for points in JFreechart
body: <p>I need to get A diamond shapes on my Timeseries in JFreechart, but I am unable to do it. Can someone please guide as to what code should be added to the code below to achieve the Diamond shape points and also how to change colours of the lines?</p>
  
  <p>(The program uses rs and stmt and other things which are derived from the DB and are defined somewhere else. The program works properly right now, only problem is that it looks super boring.)</p>
  
  <pre><code>TimeSeries s1 = new TimeSeries("Technology", Day.class);
  TimeSeries s2 = new TimeSeries("Entertainment", Day.class);
  TimeSeries s3 = new TimeSeries("Soap", Day.class);
  TimeSeries s4 = new TimeSeries("Music", Day.class);
  TimeSeries s5 = new TimeSeries("Native", Day.class);
  TimeSeries s6 = new TimeSeries("Speciality", Day.class);
  TimeSeries s7 = new TimeSeries("Science", Day.class);
  
  SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  Date plotdate;
  
  
  if (!(combo_individualid.getModel().getSize() == 0)) {
      String sql = ""
              + "SELECT * "
              + "FROM   `customerbasetag` "
              + "WHERE  `individual_idindividual` =? ";
  
      try {
          stmt = conn.prepareStatement(sql);
          stmt.setString(1, combo_individualid.getSelectedItem().toString());
          rs = stmt.executeQuery();
  
          while (rs.next()) {
  
              try {
                  plotdate = sdf.parse(rs.getString("session_date"));
  
                  s1.add(new Day(plotdate), new Integer(Integer.parseInt(rs.getString("technology"))));
                  s2.add(new Day(plotdate), new Integer(Integer.parseInt(rs.getString("entertainment"))));
                  s3.add(new Day(plotdate), new Integer(Integer.parseInt(rs.getString("soap"))));
                  s4.add(new Day(plotdate), new Integer(Integer.parseInt(rs.getString("music"))));
                  s5.add(new Day(plotdate), new Integer(Integer.parseInt(rs.getString("native"))));
                  s6.add(new Day(plotdate), new Integer(Integer.parseInt(rs.getString("speciality"))));
                  s7.add(new Day(plotdate), new Integer(Integer.parseInt(rs.getString("science"))));
  
  
              } catch (ParseException ex) {
                  JOptionPane.showMessageDialog(null,
                      "Parse Exception" + ex.getMessage());
              }
          }
      } catch (SQLException ex) {
          JOptionPane.showMessageDialog(null,
              "Error During Session Select" + ex.getMessage());
      }
  
  
      /*NOTE: Chart plotting here*/
      TimeSeriesCollection dataset = new TimeSeriesCollection();
      dataset.addSeries(s1);
      dataset.addSeries(s2);
      dataset.addSeries(s3);
      dataset.addSeries(s4);
      dataset.addSeries(s5);
      dataset.addSeries(s6);
      dataset.addSeries(s7);
      JFreeChart chart = ChartFactory.createTimeSeriesChart(
          "TS Chart", "Date", "Value", dataset, true, true, false);
  
      XYPlot plot = (XYPlot) chart.getPlot();
      plot.setBackgroundPaint(Color.lightGray);
      plot.setDomainGridlinePaint(Color.white);
      plot.setRangeGridlinePaint(Color.white);
      plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
      plot.setDomainCrosshairVisible(true);
      plot.setRangeCrosshairVisible(true);
  
      ChartFrame f = new ChartFrame("Individual Choice Evaluation", chart);
      f.setVisible(true);
      f.setSize(800, 600);
      f.setLocationRelativeTo(null);
  
  } else {
  
      JOptionPane.showMessageDialog(null, "Please Select an Individual");
  }
  </code></pre>
  
  <p>I have updated code but it does not work properly still, and I keep getting the old chart back. heres the code.</p>
  
  <pre><code>TimeSeriesCollection dataset = new TimeSeriesCollection();
              dataset.addSeries(s1);
              dataset.addSeries(s2);
              dataset.addSeries(s3);
              dataset.addSeries(s4);
              dataset.addSeries(s5);
              dataset.addSeries(s6);
              dataset.addSeries(s7);
              JFreeChart chart = ChartFactory.createTimeSeriesChart("Time Series Chart for Individual id: "+combo_individualid.getSelectedItem().toString() , "Date", "Value", dataset, true, true, false);
  
  
  
              Shape theShape = ShapeUtilities.createDiamond(1);
  
  
              XYPlot plot = (XYPlot) chart.getPlot();
              plot.setBackgroundPaint(Color.lightGray);
              plot.setDomainGridlinePaint(Color.white);
              plot.setRangeGridlinePaint(Color.white);
              plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
              plot.setDomainCrosshairVisible(true);
              plot.setRangeCrosshairVisible(true);
  
  
  
              XYItemRenderer renderer = plot.getRenderer();
  
              renderer.setSeriesShape(0, theShape);
              renderer.setSeriesShape(1, theShape);
              renderer.setSeriesShape(2, theShape);
              renderer.setSeriesShape(3, theShape);
              renderer.setSeriesShape(4, theShape);
              renderer.setSeriesShape(5, theShape);
              renderer.setSeriesShape(6, theShape);
  
  
  
  
  
              ChartFrame f = new ChartFrame("Individual Choice Evaluation", chart);
              f.setVisible(true);
              f.setSize(800, 600);
              f.setLocationRelativeTo(null);
  </code></pre>