tmpC.set(Calendar.DAY_OF_YEAR, dayOfYear);
tmpC.set(Calendar.DAY_OF_YEAR, (dayOfYear + 1));
    public void pick(JCPickEvent e) {        JCDataIndex dataIndex = e.getPickResult();        // check for all the possible failures        if (dataIndex == null) {            logger.warn("WARNING: dataIndex is null");            return;        }        ChartDataView chartDataView = dataIndex.getDataView();        if (chartDataView == null) {            logger.warn("WARNING: chartDataView is null");            return;        }        int seriesIndex = dataIndex.getSeriesIndex();        int pt = dataIndex.getPoint();        if (pt < 0 || seriesIndex < 0) {            logger.warn("WARNING: series or point index is null");            return;        }        InventoryBaseChartDataModel dataModel = (InventoryBaseChartDataModel) chartDataView.getDataSource();        if (dataModel == null) {            logger.warn("WARNING: data model is null");            return;        }        // user has picked a valid point        double[] x = dataModel.getXSeries(seriesIndex);        double[] y = dataModel.getRealYSeries(seriesIndex);        int cDay;        int dayOfYear;        int daysFromBaseToCDay = (int) ((baseCDayTime - InventoryChartBaseCalendar.getBaseTime())                / TimeUtils.MSEC_PER_DAY);        int hourOfDay = 0;        boolean displayHourly = (bucketSize < MILLIS_IN_DAY);        if (displayHourly) {            if (displayCDay) {                int cHour = ((int) x[pt]);                cDay = (cHour / TimeUtils.HOUR_PER_DAY);                //subtract 1, because in our scale between -1 and 0                //is CDay -1 and the hour, not C0                if(cHour < 1){                    cDay--;                }                hourOfDay = cHour % TimeUtils.HOUR_PER_DAY;                dayOfYear = cDay + daysFromBaseToCDay;            } else {                int hourOfYear = ((int) x[pt]);                dayOfYear = hourOfYear / TimeUtils.HOUR_PER_DAY;                hourOfDay = hourOfYear % TimeUtils.HOUR_PER_DAY;                cDay = dayOfYear - daysFromBaseToCDay;            }        } else {            if (displayCDay) {                cDay = ((int) x[pt]);                dayOfYear = cDay + daysFromBaseToCDay;            } else {                dayOfYear = ((int) x[pt]);                cDay = dayOfYear - daysFromBaseToCDay;            }        }        InventoryChartBaseCalendar tmpC = new InventoryChartBaseCalendar();        tmpC.set(Calendar.YEAR, InventoryChartBaseCalendar.getBaseYear());        tmpC.set(Calendar.DAY_OF_YEAR, dayOfYear);        tmpC.set(Calendar.HOUR_OF_DAY, hourOfDay);        // add 1 to month as it numbers them from 0        int month = tmpC.get(Calendar.MONTH) + 1;        String label;        if (displayHourly) {            label = "Date: " + month + "/" +                    tmpC.get(Calendar.DAY_OF_MONTH) + "/" +                    tmpC.get(Calendar.YEAR) + " " +                    "(C" + cDay + ") " +                    tmpC.get(Calendar.HOUR_OF_DAY) + ":00 " +                    "Quantity: " + JCChartUtil.format(y[pt], 1);        } else {            label = "Date: " + month + "/" +                    tmpC.get(Calendar.DAY_OF_MONTH) + "/" +                    tmpC.get(Calendar.YEAR) + " " +                    "(C" + cDay + ")" +                    " Quantity: " + JCChartUtil.format(y[pt], 1);        }        //System.out.println("Pick Point is: " + label);        pointLabel.setText(label);    }