Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XAxis setTickInterval not working when enabling timeline #585

Open
zaheer1389 opened this issue Sep 24, 2019 · 0 comments
Open

XAxis setTickInterval not working when enabling timeline #585

zaheer1389 opened this issue Sep 24, 2019 · 0 comments

Comments

@zaheer1389
Copy link

when using timeline the setTickInterval() on XAxis not dividing the tick interval according to the passed value for AxisType.DATETIME.

protected Component getDataCoverageChart(PatientHealthData patientHealthData) {
        Chart chart = new Chart(ChartType.COLUMN);
        chart.setTimeline(true);
        chart.setHeight("100px");
        chart.setWidth("100%");
        
        Configuration configuration = chart.getConfiguration();
        //configuration.getChart().setZoomType(ZoomType.X);
        configuration.getChart().setSpacingRight(20);
        configuration.getRangeSelector().setEnabled(false);
        configuration.getTitle().setText("");
        
        configuration.getxAxis().setType(AxisType.DATETIME);
        
        XAxis xAxis = configuration.getxAxis();
        xAxis.setTickInterval(1000*60*60*2);
        //xAxis.setLabels(new Labels(false));
 
        configuration.getTooltip().setXDateFormat("%H:%M:%S.%L");
        configuration.getLegend().setEnabled(false);
        
        YAxis yAxis = configuration.getyAxis();
        yAxis.setOpposite(false);
        yAxis.setLabels(new Labels(false));
        yAxis.setTitle(new AxisTitle(""));
        //yAxis.setMin(0.6);
        //yAxis.setStartOnTick(false);
        //yAxis.setShowFirstLabel(false);

        configuration.setTooltip(null);

/*        PlotOptionsColumn plot = new PlotOptionsColumn();
        //plot.setPointWidth(1);
        plot.setPointPadding(0.2);
        plot.setBorderWidth(0);*/

        DataSeries listSeries = new DataSeries();
    	listSeries.setName("Data coverage");
    	//PlotOptionsArea options = new PlotOptionsArea();
        //listSeries.setPlotOptions(options);
        
    	if(patientHealthData.getHealthData() != null && patientHealthData.getHealthData().getHealthDataList().length > 0){
			HealthData healthData [] = patientHealthData.getHealthData().getHealthDataList();
			Arrays.sort(healthData);
			for(HealthData healthData2 : healthData){
				try {
					Date dt = simpleDateFormat.parse(healthData2.getTimerange());
					Double doubleVal = Double.parseDouble(healthData2.getRr());
					Double formattedValue = Double.parseDouble(decimalFormat.format(doubleVal));
					//System.out.println(dt+ " , "+doubleVal);
					String value = "1";
					listSeries.add(new DataSeriesItem(dt, Double.parseDouble(value)));
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			
		}
    	configuration.setSeries(listSeries);

        chart.drawChart(configuration);
        return chart;
    }
@zaheer1389 zaheer1389 changed the title XAxis setTickInterval not working when enable timeline XAxis setTickInterval not working when enabling timeline Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant