+ // Find a good value to use for START_TIME based on the current horizontal ruler
+ // time range and the data start time.
+ IPreferenceStore csvnode = new ScopedPreferenceStore( InstanceScope.INSTANCE, CSVPreferences.P_NODE );
+ double oldStartTime = csvnode.getDouble(CSVPreferences.P_CSV_START_TIME);
+ double timeStep = csvnode.getDouble(CSVPreferences.P_CSV_TIME_STEP);
+ double visibleChartMinTime = trendNode.horizRuler.from;
+ double dataStartTime = trendNode.horizRuler.getItemFromTime();
+ // Find the first sample time that contains data if startTime < _from
+ double n = Math.max(0, Math.ceil((visibleChartMinTime-dataStartTime) / timeStep));
+ double temporaryStartTime = dataStartTime + n*timeStep;
+ csvnode.setValue(CSVPreferences.P_CSV_START_TIME, temporaryStartTime);
+