Sparkline Chart

Hi Guys,

For my application, I am using a sparkline chart on the dashboard screen to render some data. I have written a logic to load the components of the Dashboard screen for every 15 seconds to show the latest data. All the components like the labels, the grids are updating. But, the Sparkline chart is not updating. Below is the code snipped I am using.

Sparkline s = new Sparkline();
		s.setWidth("140px");
        s.setHeight("20px");
        Configuration conf = s.getConfiguration();
		Number[] downloadsData = new Number[]
{1, 10};
		DataSeries series = new DataSeries();
        for (int i = 0; i < downloadsData.length; i++) {
            DataSeriesItem item = new DataSeriesItem("", downloadsData[i]
);
            series.add(item);
        }
        conf.addSeries(series);
        conf.getChart().setAnimation(false);
		
		currentConnectionsLabel = new BoardLabel("Current Downloads", Integer.toString(dashBoardService.getLabelData(dashboardWidget).getCurrentConnections()), s, false, headerLabelCurrentDownloads, contentLabelCurrentDownloads);

I am passing the sparkline chart to one class to get the chart in verticallayout with other components.

public BoardLabel(String header, String content, Sparkline spark, boolean success, Label headerLabel, Label contentLabel) {
		
		headerLabel.setContentMode(ContentMode.HTML);
		headerLabel.addStyleName("board-box-label");
		
		contentLabel.setContentMode(ContentMode.HTML);
		contentLabel.addStyleName("board-box-label");
		
		spark.getConfiguration().setTitle("");
		spark.getConfiguration().getChart().setType(ChartType.LINE);
        spark.getConfiguration().getChart().setAnimation(true);
        spark.addStyleName("dashboard-spark");
        
        Credits c = new Credits("");
        spark.getConfiguration().setCredits(c);
         
        PlotOptionsLine opts = new PlotOptionsLine();
        opts.setAllowPointSelect(false);
        opts.setDataLabels(new DataLabels(false));
        opts.setLineWidth(1);
        opts.setShadow(false);
        opts.setDashStyle(DashStyle.SOLID);
        opts.setMarker(new Marker(false));
        opts.setEnableMouseTracking(true);
        opts.setAnimation(true);
        spark.getConfiguration().setPlotOptions(opts);
        
        Tooltip tooltip = new Tooltip();
        tooltip.setFormatter("function() { return ''+ this.y +'';}");
        tooltip.setShared(true);
        tooltip.setUseHTML(true);
        tooltip.setBorderWidth(2);
        tooltip.setBorderColor(SolidColor.WHITESMOKE);
        tooltip.setShadow(false);
        Style style = new Style();
        style.setFontSize("10px");
        style.setLineHeight("3px");
        tooltip.setStyle(style);
        spark.getConfiguration().setTooltip(tooltip);

        XAxis xAxis = spark.getConfiguration().getxAxis();
        YAxis yAxis = spark.getConfiguration().getyAxis();

        SolidColor transparent = new SolidColor(0, 0, 0, 0);

        xAxis.setLabels(new Labels(false));
        xAxis.setTickWidth(0);
        xAxis.setLineWidth(0);

        yAxis.setTitle(new AxisTitle(""));
        yAxis.setAlternateGridColor(transparent);
        yAxis.setLabels(new Labels(false));
        yAxis.setLineWidth(0);
        yAxis.setGridLineWidth(0);

		
		if(!success) {
			Color color = new SolidColor("#216c2a");
			opts.setColor(color);
			setHeaderSucess(header, headerLabel);
			setContentSucess(content, contentLabel);
		
			addComponents(contentLabel, spark, headerLabel);
			addStyleName("heartbeat-verticalLayout");
			setComponentAlignment(contentLabel, Alignment.TOP_CENTER);
			setComponentAlignment(spark, Alignment.TOP_CENTER);
			setComponentAlignment(headerLabel, Alignment.BOTTOM_CENTER);
		}else {
			Color color = new SolidColor("#ed473b");
			opts.setColor(color);
			setHeaderFailure(header, headerLabel);
			setContentFaliure(content, contentLabel);
		
			addComponents(contentLabel, spark, headerLabel);
			addStyleName("heartbeat-verticalLayout");
			
			setComponentAlignment(contentLabel, Alignment.TOP_CENTER);
			setComponentAlignment(spark, Alignment.TOP_CENTER);
			setComponentAlignment(headerLabel, Alignment.BOTTOM_CENTER);
		}
	}

Now I am using the thread to call backservice for every 15 seconds and adding that data to sparkline chart as below.

Number[] downloadsData = new Number[]
{1, 10, 89, 7, 35, 110, 2, 54,22, 8, 109, 12, 77, 99, 88, 775};
		DataSeries series = new DataSeries();
        for (int i = 0; i < downloadsData.length; i++) {
            DataSeriesItem item = new DataSeriesItem("", downloadsData[i]
);
            series.add(item);
        }
		
		s.getConfiguration().setSeries(series);
		
		getUI().setPollInterval(15000);

Please let me know why the sparkline chart is not updating even after calling the getUI().setPollInterval