
			  try {
				date_start = sdf.parse(date_from);
				date_end = sdf.parse(date_to);
				 

				try {
				
				
					
				logs=new ArrayList<EventLogs>();
					
					
					
			  logs=new HibernateEventLogs().getdatesbetween(choice_1.getSelectedItem(),date_start,date_end);//.add( new HibernateEventLogs().getdatesbetween(choices.get(i).getSelectedItem(),date_start,date_end)); //lista eventlogova ciji su datumi između unesenih u datepickere i odgovara im odgovrajuci device name u suprotnom vraca null tako da bi i to trebalo ispitati.

				}
				
				finally {}

				
				size=logs.size();
				values=new ArrayList<Double>();
				
				for(int i=0; i<logs.size();i++){
					
		        
					JOptionPane.showMessageDialog(null,logs.get(i).getValue(), "InfoBox", JOptionPane.INFORMATION_MESSAGE);
						
					values.add(logs.get(i).getValue());           
				
					
					
					 
				}
				}catch(Exception e){
					 final JLabel lblExport= new JLabel("To export graph, make right click, and choose Export Image.");
					System.out.println("Ne poklapaju se vrijednosti");
				}
			 
			  
			  DataTable d=new DataTable(Long.class, Double.class, String.class);
			 
			  
			  for(int i=0;i<logs.size();i++)
			  {
				 
					
					d.add(logs.get(i).getTimestamp().getTime(), values.get(i),logs.get(i).getDevice_name());
	  }
			  
			  final BarPlot plot= new BarPlot(d);
								plot.setInsets(new Insets2D.Double(30.0, 40.0, 40.0, 0.0));
				 plot.getTitle().setText("Bar plot");
					
				  plot.setBarWidth(0.075);
			         // Format bars
			    BarRenderer pointRenderer = (BarRenderer) plot.getPointRenderer(d);
			    pointRenderer.setColor(
			           new LinearGradientPaint(0f,0f, 0f,1f,
			           new float[] { 0.0f, 1.0f },
			           new Color[] { COLOR1, GraphicsUtils.deriveBrighter(COLOR1) }
			                 )
			         );
			       
			    pointRenderer.setBorderStroke(new BasicStroke(3f));
		      pointRenderer.setBorderColor(
		              new LinearGradientPaint(0f,0f, 0f,1f,
		                              new float[] { 0.0f, 1.0f },
		                              new Color[] { GraphicsUtils.deriveBrighter(COLOR1), COLOR1 }
		              )
		      );
		      
		     		 
		      plot.getAxisRenderer(XYPlot.AXIS_Y).setTickSpacing(1.0);

		      AxisRenderer rendererX = plot.getAxisRenderer(XYPlot.AXIS_X);
		      DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
		      rendererX.setTickLabelFormat(dateFormat);
		      
		      
		      pointRenderer.setValueVisible(true);
		      pointRenderer.setValueColumn(1);
		      pointRenderer.setValueLocation(Location.CENTER);
		      pointRenderer.setValueColor(GraphicsUtils.deriveDarker(COLOR1));
		      pointRenderer.setValueFont(Font.decode(null).deriveFont(Font.BOLD));
			         
			         interactivePanel = new InteractivePanel(plot);
			         
			         interactivePanel.setLayout(null);
			         interactivePanel.setBounds(new Rectangle(0, 0, 440, 400));
			         //interactivePanel.setOpaque(true);

			       
			          interactivePanel.setVisible(true);
			  
			          Date dateString2 = (Date) datePicker.getModel().getValue();
				  		String date_from1 = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(dateString);
				  		Date dateString3 = (Date) datePicker1.getModel().getValue();
				  		String date_to1 = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(dateString1);	
						SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
						Date date_start1;
						Date date_end1;
						
						  try {
							date_start1 = sdf1.parse(date_from1);
							date_end1 = sdf1.parse(date_to1);
							 

							try {
								date_start = sdf.parse(date_from);
								date_end = sdf.parse(date_to);
								
							logs1=new ArrayList<EventLogs>();
								
								
							
								
						  logs1=new HibernateEventLogs().getdatesbetween(choice_12.getSelectedItem(),date_start1,date_end1);//.add( new HibernateEventLogs().getdatesbetween(choices.get(i).getSelectedItem(),date_start,date_end)); //lista eventlogova ciji su datumi između unesenih u datepickere i odgovara im odgovrajuci device name u suprotnom vraca null tako da bi i to trebalo ispitati.
						 
							}
							
							finally {}
							size=logs.size();
							JOptionPane.showMessageDialog(null,choice_12.getSelectedItem(), "InfoBox", JOptionPane.INFORMATION_MESSAGE);
							  values1=new ArrayList<Double>();
							
							for(int i=0; i<logs1.size();i++){
								
					      
							
									
								values1.add(logs1.get(i).getValue());
								
							
								
								 
							}
							}catch(Exception e){
								 
								System.out.println("Ne poklapaju se vrijednosti");
							}
						 
						  DataTable d1=new DataTable(Long.class, Double.class, String.class);
						 
						  
						  for(int j=0;j<logs1.size();j++)
						  {
							 
								
								d1.add(logs1.get(j).getTimestamp().getTime(), values1.get(j),logs1.get(j).getDevice_name());
				  }
							
							
						  
						  
						  final BarPlot plot1= new BarPlot(d1);
							
							plot1.setInsets(new Insets2D.Double(30.0, 40.0, 40.0, 0.0));
							 plot1.getTitle().setText("Bar plot");
								
							  plot1.setBarWidth(0.075);
						        
						    BarRenderer pointRenderer1 = (BarRenderer) plot1.getPointRenderer(d1);
						    pointRenderer1.setColor(
						           new LinearGradientPaint(0f,0f, 0f,1f,
						           new float[] { 0.0f, 1.0f },
						           new Color[] { COLOR1, GraphicsUtils.deriveBrighter(COLOR1) }
						                 )
						         );
						       
						    pointRenderer1.setBorderStroke(new BasicStroke(3f));
					      pointRenderer1.setBorderColor(
					              new LinearGradientPaint(0f,0f, 0f,1f,
					                              new float[] { 0.0f, 1.0f },
					                              new Color[] { GraphicsUtils.deriveBrighter(COLOR1), COLOR1 }
					              )
					      );
					      
					     		 
					      plot1.getAxisRenderer(XYPlot.AXIS_Y).setTickSpacing(1.0);

					      AxisRenderer rendererX1 = plot1.getAxisRenderer(XYPlot.AXIS_X);
					      DateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
					      rendererX1.setTickLabelFormat(dateFormat);
					      
					      
					      pointRenderer1.setValueVisible(true);
					      pointRenderer1.setValueColumn(1);
					      pointRenderer1.setValueLocation(Location.CENTER);
					      pointRenderer1.setValueColor(GraphicsUtils.deriveDarker(COLOR1));
					      pointRenderer1.setValueFont(Font.decode(null).deriveFont(Font.BOLD));
						         
						   
					      values2=new ArrayList<Double>();
							double vel;
							int k;
							if(logs1.get(logs1.size()-1).getTimestamp().getDate()