List of usage examples for java.util Collections min
public static <T extends Object & Comparable<? super T>> T min(Collection<? extends T> coll)
From source file:cfa.vo.iris.sed.ExtSed.java
public void checkChar() { for (int i = 0; i < this.getNumberOfSegments(); i++) { Segment segment = this.getSegment(i); List<Double> spectral; try {//from w w w .j a v a2 s . c o m spectral = Arrays.asList(ArrayUtils.toObject(segment.getSpectralAxisValues())); double min = Collections.min(spectral); double max = Collections.max(spectral); segment.createChar().createSpectralAxis().createCoverage().createBounds().createRange().createMin() .setValue(min); segment.createChar().createSpectralAxis().createCoverage().createBounds().createRange().createMax() .setValue(max); segment.createChar().createSpectralAxis().createCoverage().createBounds().createExtent() .setValue(max - min); } catch (SedNoDataException ex) { Logger.getLogger(ExtSed.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:reader.ArgumentUnitTCReader.java
@Override public void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); // read input file with texts (= argument units) and labels labels = new ArrayList<String>(); texts = new ArrayList<String>(); Iterator<Map<String, Object>> documentsIterator; try {/*from w w w . j ava 2 s . c om*/ String inputString = FileUtils.readFileToString(this.inputFile); JSONParser jsonParser = new JSONParser(); @SuppressWarnings("unchecked") ArrayList<Map<String, Object>> jsonTexts = new ArrayList<Map<String, Object>>( (List<Map<String, Object>>) jsonParser.parse(inputString)); documentsIterator = jsonTexts.iterator(); while (documentsIterator.hasNext()) { Map<String, Object> jsonData = documentsIterator.next(); @SuppressWarnings("unchecked") List<Map<String, Object>> userAnnotations = (List<Map<String, Object>>) jsonData .get(JsonCorpusUtil.USER_ANNOTATIONS); for (Map<String, Object> userAnnotation : userAnnotations) { String annotator = (String) userAnnotation.get(JsonCorpusUtil.ANNOTATOR); if (annotator.equals(this.annotator)) { String htmlText = (String) jsonData.get(JsonCorpusUtil.TEXT); org.jsoup.nodes.Document cleanedText = Jsoup.parse(htmlText); String rawDocumentText = cleanedText.text(); Map<Integer, Token> idxToTokenMapping = this.createIndexToTokenMapping(rawDocumentText); @SuppressWarnings("unchecked") List<String> argUnits = (List<String>) userAnnotation .get(JsonCorpusUtil.ARGUMENTATION_UNITS); for (String argUnit : argUnits) { //System.out.println("au: " +argUnit); String cleanedArgUnit = argUnit.replaceAll("\\s+", ""); Matcher matcher = JsonCorpusUtil.getRecognitionPattern().matcher(cleanedArgUnit); if (!matcher.matches()) { this.getLogger() .warn(String.format( "argument unit %s does not match the expected pattern %s", cleanedArgUnit, JsonCorpusUtil.getRecognitionPattern().pattern())); } else { // ************************************************** // coordinates of an argument unit: String label = matcher.group(1); String stringIndices = matcher.group(3).replaceAll("^,", ""); List<Integer> indices = CollectionUtils.parseIntList(stringIndices, ","); int firstIndex = Collections.min(indices); Token firstToken = idxToTokenMapping.get(firstIndex); int lastIndex = Collections.max(indices); Token lastToken = idxToTokenMapping.get(lastIndex); //String text = getArgunitText(firstIndex, lastIndex); // ***************************************************** String generalizedLabel = getGeneralizedLabel(label); // Read argument unit as dummy Paragraph annotation to get the text JCas dummyJCas = JCasFactory.createJCas(); dummyJCas.setDocumentText(rawDocumentText); Paragraph para = new Paragraph(dummyJCas, firstToken.getBegin(), lastToken.getEnd()); //System.out.println("argument unit text: " +para.getCoveredText()); texts.add(para.getCoveredText()); labels.add(generalizedLabel); //System.out.println("annotator: " +annotator); System.out.println("label: " + label + " general label: " + generalizedLabel); } // matching was ok } // for argUnit : argUnits } // if annotator.equals(this.annotator) } // for user annotation } // while hasNext } catch (final IOException e) { throw new ResourceInitializationException(e); } catch (final ParseException e) { throw new ResourceInitializationException(e); } catch (UIMAException e) { throw new ResourceInitializationException(e); } offset = 0; System.out.println("number of AUs: " + texts.size()); }
From source file:org.apache.kylin.storage.hbase.ii.coprocessor.endpoint.EndpointTupleIterator.java
public EndpointTupleIterator(IISegment segment, TupleFilter rootFilter, Collection<TblColRef> groupBy, List<FunctionDesc> measures, StorageContext context, HConnection conn, TupleInfo returnTupleInfo) throws Throwable { String tableName = segment.getStorageLocationIdentifier(); table = conn.getTable(tableName);/*from ww w . j a va2 s . com*/ factTableName = segment.getIIDesc().getFactTableName(); if (rootFilter == null) { rootFilter = ConstantTupleFilter.TRUE; } if (groupBy == null) { groupBy = Sets.newHashSet(); } if (measures == null) { measures = Lists.newArrayList(); } //this method will change measures rewriteMeasureParameters(measures, segment.getColumns()); this.seg = segment; this.columns = segment.getColumns(); this.tupleInfo = returnTupleInfo; this.tupleConverter = new EndpointTupleConverter(columns, measures, returnTupleInfo); this.tableRecordInfo = new TableRecordInfo(this.seg); this.pushedDownRowType = CoprocessorRowType.fromTableRecordInfo(tableRecordInfo, this.columns); this.pushedDownFilter = CoprocessorFilter.fromFilter(new ClearTextDictionary(this.tableRecordInfo), rootFilter, FilterDecorator.FilterConstantsTreatment.AS_IT_IS); for (TblColRef column : this.pushedDownFilter.getInevaluableColumns()) { groupBy.add(column); } this.pushedDownProjector = CoprocessorProjector.makeForEndpoint(tableRecordInfo, groupBy); this.pushedDownAggregators = EndpointAggregators.fromFunctions(tableRecordInfo, measures); int tsCol = this.tableRecordInfo.getTimestampColumn(); this.partitionCol = this.columns.get(tsCol); this.tsRange = TsConditionExtractor.extractTsCondition(this.partitionCol, rootFilter); if (this.tsRange == null) { logger.info("TsRange conflict for endpoint, return empty directly"); this.tupleIterator = ITupleIterator.EMPTY_TUPLE_ITERATOR; } else { logger.info("The tsRange being pushed is " + RangeUtil.formatTsRange(tsRange)); } IIProtos.IIRequest endpointRequest = prepareRequest(); Collection<IIProtos.IIResponse> compressedShardResults = getResults(endpointRequest, table); //decompress Collection<IIProtos.IIResponseInternal> shardResults = new ArrayList<>(); for (IIProtos.IIResponse input : compressedShardResults) { byte[] compressed = HBaseZeroCopyByteString.zeroCopyGetBytes(input.getBlob()); try { byte[] decompressed = CompressionUtils.decompress(compressed); shardResults.add(IIProtos.IIResponseInternal.parseFrom(decompressed)); } catch (Exception e) { throw new RuntimeException("decompress endpoint response error"); } } this.lastDataTime = Collections .min(Collections2.transform(shardResults, new Function<IIProtos.IIResponseInternal, Long>() { @Nullable @Override public Long apply(IIProtos.IIResponseInternal input) { IIProtos.IIResponseInternal.Stats status = input.getStats(); logger.info( "Endpoints all returned, stats from shard {}: start moment:{}, finish moment: {}, elapsed ms: {}, scanned slices: {}, latest slice time is {}", // new Object[] { String.valueOf(status.getMyShard()), // DateFormat.formatToTimeStr(status.getServiceStartTime()), // DateFormat.formatToTimeStr(status.getServiceEndTime()), // String.valueOf(status.getServiceEndTime() - status.getServiceStartTime()), // String.valueOf(status.getScannedSlices()), DateFormat.formatToTimeStr(status.getLatestDataTime()) }); return status.getLatestDataTime(); } })); this.regionResponsesIterator = Collections2.transform(shardResults, new Function<IIProtos.IIResponseInternal, List<IIProtos.IIResponseInternal.IIRow>>() { @Nullable @Override public List<IIProtos.IIResponseInternal.IIRow> apply( @Nullable IIProtos.IIResponseInternal input) { return input.getRowsList(); } }).iterator(); if (this.regionResponsesIterator.hasNext()) { this.tupleIterator = new SingleRegionTupleIterator(this.regionResponsesIterator.next()); } else { this.tupleIterator = ITupleIterator.EMPTY_TUPLE_ITERATOR; } }
From source file:be.ugent.maf.cellmissy.analysis.singlecell.preprocessing.impl.SingleCellConditionPreProcessorImpl.java
@Override public void generateRawCoordinatesRanges(SingleCellConditionDataHolder singleCellConditionDataHolder) { singleCellConditionDataHolder.getSingleCellWellDataHolders().stream() .forEach((singleCellWellDataHolder) -> { singleCellWellPreProcessor.generateRawCoordinatesRanges(singleCellWellDataHolder); });// w w w . ja v a 2 s . c o m Double[][] transposedMatrix = AnalysisUtils .transpose2DArray(singleCellConditionDataHolder.getRawTrackCoordinatesMatrix()); // compute the min and the max coordinates Double xMin = Collections.min(Arrays.asList(transposedMatrix[0])); Double xMax = Collections.max(Arrays.asList(transposedMatrix[0])); Double yMin = Collections.min(Arrays.asList(transposedMatrix[1])); Double yMax = Collections.max(Arrays.asList(transposedMatrix[1])); Double[][] rawCoordinatesRanges = new Double[2][2]; rawCoordinatesRanges[0] = new Double[] { xMin, xMax }; rawCoordinatesRanges[1] = new Double[] { yMin, yMax }; singleCellConditionDataHolder.setRawCoordinatesRanges(rawCoordinatesRanges); }
From source file:org.azrul.langmera.QLearningAnalytics.java
@Override public void learn(DecisionFeedback currentFeedback, Vertx vertx, Runnable responseAction) { LocalMap<String, DetailDecisionFeedback> decisionFeedbackMap = vertx.sharedData() .getLocalMap("DECISION_FEEDBACK"); LocalMap<String, DecisionRequest> decisionRequestMap = vertx.sharedData().getLocalMap("DECISION_REQUEST"); LocalMap<String, DecisionResponse> decisionResponseMap = vertx.sharedData() .getLocalMap("DECISION_RESPONSE"); LocalMap<String, Double> q = vertx.sharedData().getLocalMap("Q"); LocalMap<Long, String> trackers = vertx.sharedData().getLocalMap("FEEDBACK_TRACKER"); int feedbackCount = decisionFeedbackMap.size(); boolean skipLearning = false; if (decisionRequestMap.get(currentFeedback.getDecisionId()) == null) { skipLearning = true;/*from w ww .ja va 2s . c o m*/ } if (decisionResponseMap.get(currentFeedback.getDecisionId()) == null) { skipLearning = true; } if (skipLearning == false) { String context = decisionRequestMap.get(currentFeedback.getDecisionId()).getContext(); String decision = decisionResponseMap.get(currentFeedback.getDecisionId()).getDecision(); DetailDecisionFeedback detailFB = new DetailDecisionFeedback(); detailFB.setFeedback(currentFeedback); detailFB.setContext(context); detailFB.setDecision(decision); decisionFeedbackMap.put(currentFeedback.getDecisionId(), detailFB); Long trackerKey = (new Date()).getTime(); trackers.put(trackerKey, currentFeedback.getDecisionId()); int feedbackCountByDecision = 0; List<Double> rewards = new ArrayList<>(); for (DetailDecisionFeedback fb : decisionFeedbackMap.values()) { if (context.equals(decisionFeedbackMap.get(fb.getFeedback().getDecisionId()).getContext()) && decision .equals(decisionFeedbackMap.get(fb.getFeedback().getDecisionId()).getDecision())) { feedbackCountByDecision++; rewards.add(fb.getFeedback().getScore()); } } Double w = 0.0; Double alpha = config.getProperty("alpha", Double.class); //if no step parameter is configured, calculate it if (alpha == null) { alpha = 1.0 / (feedbackCountByDecision); } //non-stationary q-learning int i = 0; for (Double ri : rewards) { i++; w = w + alpha * (Math.pow(1 - alpha, feedbackCountByDecision - i)) * ri; } Double newQ = w; //System.out.println(feedbackCount+" Q:["+context + ":" + decision+"]"+newQ); //save what we learn if (newQ.isInfinite() || newQ.isNaN()) { //skip } else { String key = context + ":" + decision; q.put(key, newQ); } //Limit the number of history taken into account - prevents memory leak if (feedbackCount > config.getProperty("maxHistoryRetained", Integer.class)) { Long tk = Collections.min(trackers.keySet()); String decisionIDWithMinTracker = trackers.get(tk); decisionFeedbackMap.remove(decisionIDWithMinTracker); trackers.remove(tk); } //clear cached req/resp once the feedback has come back decisionRequestMap.remove(currentFeedback.getDecisionId()); decisionResponseMap.remove(currentFeedback.getDecisionId()); //Get maxQ Double maxQ = Double.NEGATIVE_INFINITY; String decisionWithMaxQ = null; for (String contextDecision : q.keySet()) { if (q.get(contextDecision) > maxQ) { decisionWithMaxQ = contextDecision; maxQ = q.get(contextDecision); } } //keep traces if (Boolean.TRUE.equals(config.getProperty("collect.traces", Boolean.class))) { Date now = new Date(); for (String contextDecision : q.keySet()) { List<Double> qtrace = traces.get(contextDecision); if (qtrace == null) { qtrace = new ArrayList<Double>(); qtrace.add(q.get(contextDecision)); traces.put(contextDecision, qtrace); } else { qtrace.add(q.get(contextDecision)); } String[] c = contextDecision.split(":"); Trace trace = new Trace(currentFeedback.getDecisionId(), c[0], q.get(contextDecision), maxQ, now, c[1], currentFeedback.getScore()); vertx.eventBus().publish("SAVE_TRACE_TO_TRACE", SerializationUtils.serialize((Serializable) trace)); } } // //put in in-memory DB // // // String[] c = decisionWithMaxQ.split(":"); // if (InMemoryDB.store.get(0)==null){ // List<Object> imContext = new ArrayList<Object>(); // imContext.add(c[0]); // InMemoryDB.store.add(0,imContext); // }else{ // InMemoryDB.store.get(0).add(c[0]); // } // // if (InMemoryDB.store.get(1)==null){ // List<Object> imDecision = new ArrayList<Object>(); // imDecision.add(c[1]); // InMemoryDB.store.add(1,imDecision); // }else{ // InMemoryDB.store.get(1).add(c[1]); // } // // if (InMemoryDB.store.get(2)==null){ // List<Object> imMaxQ = new ArrayList<Object>(); // imMaxQ.add(maxQ); // InMemoryDB.store.add(2,imMaxQ); // }else{ // InMemoryDB.store.get(2).add(maxQ); // } // // if (InMemoryDB.store.get(3)==null){ // List<Object> imTime= new ArrayList<Object>(); // imTime.add(new Date()); // InMemoryDB.store.add(3,imTime); // }else{ // InMemoryDB.store.get(3).add(new Date()); // } responseAction.run(); if (Boolean.TRUE.equals(currentFeedback.getTerminal())) { long delta = (new Date()).getTime() - startTime; System.out.println("Time taken to process " + feedbackCount + " msgs:" + delta + " ms"); System.out.println("Time taken per msg: " + (delta / feedbackCount) + " ms"); System.out .println("Msgs per s: " + ((1000.0 * (double) feedbackCount) / ((double) delta)) + " msgs"); if (Boolean.TRUE.equals(config.getProperty("collect.traces", Boolean.class)) && Boolean.TRUE.equals(config.getProperty("display.desktop.chart", Boolean.class))) { final LineChart demo = new LineChart(chartDesc, traces); demo.pack(); demo.setVisible(true); } } } else { logger.log(Level.WARNING, "Attempt to learn from a feedback with no corresponding request/response"); responseAction.run(); } // //select qmovies,qsports,qconcerts from // (select t1.qvalue as qsports,t1.decisionid from trace t1 where t1.decision='SPORTS' order by t1.decisiontime) as A1 // join (select t2.qvalue as qmovies,t2.decisionid from trace t2 where t2.decision='MOVIES' order by t2.decisiontime) as A2 on A1.decisionid = A2.decisionid // join (select t3.qvalue as qconcerts,t3.decisionid from trace t3 where t3.decision='CONCERTS' order by t3.decisiontime) as A3 on A1.decisionid = A3.decisionid }
From source file:Simulator.PerformanceCalculation.java
JPanel minmaxwaitTime2(boolean minCheck) { LinkedHashSet no = new LinkedHashSet(); LinkedHashMap<Integer, ArrayList<Double>> wait1 = new LinkedHashMap<>(); for (Map.Entry<Integer, TraceObject> entry : l.getLocalTrace().entrySet()) { TraceObject traceObject = entry.getValue(); if (wait1.get(traceObject.getSurgeonId()) == null) { ArrayList details = new ArrayList(); details.add(traceObject.getWaitTime2()); wait1.put(traceObject.getSurgeonId(), details); } else {/*from w ww . ja v a2 s . c o m*/ wait1.get(traceObject.getSurgeonId()).add(traceObject.getWaitTime2()); } no.add(traceObject.getSurgeonId()); } XYSeriesCollection dataset = new XYSeriesCollection(); LinkedHashMap<Integer, Double> average = new LinkedHashMap<>(); for (Map.Entry<Integer, ArrayList<Double>> entry : wait1.entrySet()) { Integer integer = entry.getKey(); ArrayList<Double> arrayList = entry.getValue(); double value = 0; if (minCheck) { value = Collections.min(arrayList); value = value / 600; } else { value = Collections.max(arrayList); value = value / 600; } average.put(integer, value); } XYSeries series = new XYSeries("Surgeon Minimum Wait Time 2"); for (int i = 1; i <= average.size(); i++) { series.add(i, average.get(i)); } dataset.addSeries(series); String name; if (minCheck) { name = "Minimum"; } else { name = "Maximum"; } // Generate the graph JFreeChart chart = ChartFactory.createXYLineChart(name + " Wait Time 2 For Patients", // Title "Surgeon ID", // x-axis Label "Time (Days)", // y-axis Label dataset, // Dataset PlotOrientation.VERTICAL, // Plot Orientation true, // Show Legend true, // Use tooltips false // Configure chart to generate URLs? ); XYPlot xyPlot = (XYPlot) chart.getPlot(); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyPlot.getRenderer(); renderer.setBaseShapesVisible(true); NumberAxis domain = (NumberAxis) xyPlot.getDomainAxis(); domain.setVerticalTickLabels(true); return new ChartPanel(chart); }
From source file:com.haulmont.cuba.desktop.gui.components.DesktopDateField.java
protected int findTimeStartPos(String dateTimeFormat) { List<Integer> positions = new ArrayList<>(); char[] signs = new char[] { 'H', 'h', 'm', 's' }; for (char sign : signs) { int pos = dateTimeFormat.indexOf(sign); if (pos > -1) { positions.add(pos);/*from w w w. jav a 2 s . co m*/ } } return positions.isEmpty() ? -1 : Collections.min(positions); }
From source file:wef.articulab.view.ui.BNXYPlot.java
public void setDataset(ArrayList<Double>[] behaviors, double threshhold, String nameBehActivated, double activation) { this.behaviors = behaviors; this.thresholds.add(threshhold); this.activations.add(new Object[] { nameBehActivated, activation }); maxThreshold = Collections.max(thresholds); minThreshold = Collections.min(thresholds); if (activation > maxActivation) { maxActivation = activation;//from w ww . j a v a 2s . c o m } double portion = (maxThreshold - minThreshold) / 6; if ((portion * 6) > (maxActivation / 4)) { maxThreshold = threshhold + portion > maxThreshold ? maxThreshold : threshhold + portion; minThreshold = threshhold - portion < minThreshold ? minThreshold : threshhold - portion; } refreshDataset(); chart.fireChartChanged(); }
From source file:org.egov.infra.gis.service.GeoLocationService.java
/** * //w ww .jav a2 s.c om * @param wardWiseData Map<String, Integer>- Map having the key as the ward number and value as the no of complaints/properties/assets * in that ward. e.g [<Ward Number>,<no Of Complaints/assets/properties> ] * * @param colorCodes Map<Integer,String> - Map having colour codes , the key as the the colour priority and value as the colour * code in RGB format. e.g - key = 1 , means the associated colour to represent the ward having no of complaints/assets/properties * that falls in highest range , key = 2 means associated colour to represent ward having no of complaints/assets/properties * that falls in the 2nd highest range and so on. * example : (1, "FF0000"); * (2, "8968CD"); * (3, "FFA500"); * (4, "4169E1"); * (5, "008B00"); */ public static void setKmlDataToCacheAndRequest(Map<String, BigDecimal> wardWiseData, Map<Integer, String> colorCodes, String kmlPath, HttpServletRequest request) { LOGGER.debug("GeoLocationService | setKmlDataToCacheAndRequest | Start"); int totalNoOfColors = colorCodes.size(); BigDecimal wardDataMinAmount = Collections.min(wardWiseData.values()).setScale(0, BigDecimal.ROUND_HALF_UP); // to hold the minimum amount in all the wards. BigDecimal wardDataMaxAmount = Collections.max(wardWiseData.values()).setScale(0, BigDecimal.ROUND_HALF_UP); // to hold the maximum amount in all the wards. if ((wardDataMaxAmount.subtract(wardDataMinAmount)).compareTo(BigDecimal.valueOf(totalNoOfColors)) == -1) { throw new ValidationException(Arrays.asList(new ValidationError("colorrange", "no of colors supplied is more than the range of data " + "in the wards"))); } BigDecimal rangeSize = getRangeSize(wardDataMinAmount, wardDataMaxAmount, totalNoOfColors); GeoKmlInfo geoKmlInfo = new GeoKmlInfo(); Map<String, String> wardWiseKmlColorStyle = new HashMap<String, String>(); for (Map.Entry<String, BigDecimal> entry : wardWiseData.entrySet()) { wardWiseKmlColorStyle.put("style" + entry.getKey(), getStyleColorName(entry.getValue(), wardDataMinAmount, totalNoOfColors, rangeSize)); } geoKmlInfo.setWardWiseColor(wardWiseKmlColorStyle); geoKmlInfo.setColorCodes(convertToKmlColor(colorCodes)); request.setAttribute(GeoLocationConstants.KML_DATA_MODEL_JBOSS_CACHE_KEY_NAME, putKmlDataToCache(geoKmlInfo)); request.setAttribute(GeoLocationConstants.COLOR_CODE_AND_RANGE_MAP_NAME, getColorRange(wardDataMinAmount, wardDataMaxAmount, rangeSize, colorCodes)); if (null != kmlPath && StringUtils.isNotEmpty(kmlPath)) { request.setAttribute(GeoLocationConstants.KML_URL_PATH_REQ_ATTR_NAME, kmlPath); } LOGGER.debug("GeoLocationService | setKmlDataToCacheAndRequest | End"); }
From source file:com.sam_chordas.android.stockhawk.ui.ChartFragment.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { listBidPrice = new ArrayList<>(); listDate = new ArrayList<>(); // Set the cursor in our CursorAdapter once the Cursor is loaded if (cursor != null && cursor.moveToFirst()) { Log.e("CURSOR SIZE=========>", String.valueOf(cursor.getCount())); int columnHistoryId = cursor.getColumnIndex(HistoryColumns._ID); int columnBidPriceIndex = cursor.getColumnIndex(HistoryColumns.BID_PRICE); int columnDateIndex = cursor.getColumnIndex(HistoryColumns.BID_DATE); String id = cursor.getString(columnHistoryId); String price = cursor.getString(columnBidPriceIndex); //put price to bid list listBidPrice.add(price);/*from w w w . j a v a 2 s.c o m*/ String bidDate = cursor.getString(columnDateIndex); //put price to bid list listDate.add(bidDate); while (cursor.moveToNext()) { id = cursor.getString(columnHistoryId); price = cursor.getString(columnBidPriceIndex); //put price to bid list listBidPrice.add(price); bidDate = cursor.getString(columnDateIndex); //put price to bid list listDate.add(bidDate); } //set data to chart LineData data = new LineData(getXAxisValues(), getDataSet()); chart.setData(data); // let the chart know it's data has changed data.notifyDataChanged(); chart.notifyDataSetChanged(); //scale Y-axis YAxis leftAxis = chart.getAxisLeft(); YAxis rightAxis = chart.getAxisRight(); //don't start at 0 leftAxis.setStartAtZero(false); rightAxis.setStartAtZero(false); //get min and max values from arraylist String minVal = Collections.min(listBidPrice); String maxVal = Collections.max(listBidPrice); Log.i("MINIMUM VALUE_------>", minVal); Log.i("MAXIMUM VALUE_------>", maxVal); Float minFloat = Float.valueOf(minVal); Float maxFloat = Float.valueOf(maxVal); Log.e("MINIMUM FLOAT------>", minFloat.toString()); Log.e("MAXIMUM FLOAT------>", maxFloat.toString()); //set min and max values for better scaling leftAxis.setAxisMaxValue(maxFloat); leftAxis.setAxisMinValue(minFloat); rightAxis.setAxisMaxValue(maxFloat); rightAxis.setAxisMinValue(minFloat); // format values into two decimal points only data.setValueFormatter(new MyValueFormatter()); //refresh chart chart.invalidate(); } for (String price : listBidPrice) { System.out.println("PRICE ===========>" + price); } for (String bidDate : listDate) { System.out.println("BID DATE ===========>" + bidDate); } }