• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EntryXComparator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.github.mikephil.charting.utils.EntryXComparator的典型用法代码示例。如果您正苦于以下问题:Java EntryXComparator类的具体用法?Java EntryXComparator怎么用?Java EntryXComparator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EntryXComparator类属于com.github.mikephil.charting.utils包,在下文中一共展示了EntryXComparator类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setData

import com.github.mikephil.charting.utils.EntryXComparator; //导入依赖的package包/类
private void setData(int count, float range) {

        ArrayList<Entry> entries = new ArrayList<Entry>();

        for (int i = 0; i < count; i++) {
            float xVal = (float) (Math.random() * range);
            float yVal = (float) (Math.random() * range);
            entries.add(new Entry(xVal, yVal));
        }

        // sort by x-value
        Collections.sort(entries, new EntryXComparator());

        // create a dataset and give it a type
        LineDataSet set1 = new LineDataSet(entries, "DataSet 1");

        set1.setLineWidth(1.5f);
        set1.setCircleRadius(4f);

        // create a data object with the datasets
        LineData data = new LineData(set1);

        // set data
        mChart.setData(data);
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:InvertedLineChartActivity.java


示例2: onChartResult

import com.github.mikephil.charting.utils.EntryXComparator; //导入依赖的package包/类
/**
 *
 * @param items
 */
@Override
public void onChartResult(List<CexCharItem> items) {
    _btcChartEntries = new ArrayList<Entry>();

    for (int i = 0; i < items.size(); i ++) {
        Float price = Float.parseFloat(items.get(i).getPrice());
        Long timestamp = Long.parseLong(items.get(i).getTmsp());
        _btcChartEntries.add(new Entry(timestamp, price));
    }

    Collections.sort(_btcChartEntries, new EntryXComparator());
    updateGraph(_btcChartEntries);
    updateBalance(_lastBalance);
}
 
开发者ID:ehanoc,项目名称:xwallet,代码行数:19,代码来源:WalletFragment.java


示例3: buildScatterDataForProperty

import com.github.mikephil.charting.utils.EntryXComparator; //导入依赖的package包/类
private ScatterData buildScatterDataForProperty(WaterProfile profile, String property){
  ScatterData data = new ScatterData();

  if (profile != null){
    // Get all the measurements for the property
    Map<Double,Double> propertyMeasurementByDepth = profile.getMeasurementsForProperty(property);
    ArrayList<Entry> entries = new ArrayList<>();
    Set<Double> depths = propertyMeasurementByDepth.keySet();
    for (Double depth : depths){
      float y = (float) Math.abs(depth);
      float x = (float) propertyMeasurementByDepth.get(depth).doubleValue();
      entries.add(new Entry(x, y));
    }
    Collections.sort(entries, new EntryXComparator());

    ScatterDataSet set = new ScatterDataSet(entries, property);
    set.setColor(Color.BLACK);
    set.setScatterShape(ScatterChart.ScatterShape.CIRCLE);
    set.setScatterShapeSize(20f);
    set.setDrawValues(false);
    data.addDataSet(set);
  }else{
    Log.e(TAG, "Profile data object is null!");
  }

  return  data;
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:28,代码来源:WaterProfilePresenter.java


示例4: buildEMULayers

import com.github.mikephil.charting.utils.EntryXComparator; //导入依赖的package包/类
private LineData buildEMULayers(float xmin, float xmax){
  LineData data = new LineData();
  WaterColumn column = mDataManager.getCurrentWaterColumn();

  if (column != null){
    Set<EMUObservation> observations = column.getEmuSet();
    for (final EMUObservation observation : observations){
      ArrayList<Entry> entries = new ArrayList<>();

      for (float index = xmin; index <= xmax; index++) {
        entries.add(new Entry(index, Math.abs(observation.getTop())));
      }
      Collections.sort(entries, new EntryXComparator());

      LineDataSet set = new LineDataSet(entries, "Line DataSet");
      set.setAxisDependency(YAxis.AxisDependency.LEFT);
      set.setFillColor(Color.parseColor(EmuHelper.getColorForEMUCluster(observation.getEmu().getName())));

      set.setFillAlpha(255);
      set.setDrawCircles(false);
      set.setDrawValues(false);
      set.setDrawFilled(true);
      set.setHighLightColor(Color.rgb(244, 117, 117));
      set.setDrawCircleHole(false);
      set.setFillFormatter(new IFillFormatter() {
        @Override
        public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {
          return Math.abs(observation.getTop()) + observation.getThickness();
        }
      });
      data.addDataSet(set);
    }
  }else{
    Log.e(TAG, "Water column data object is null!");
  }


  return data;
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:40,代码来源:WaterProfilePresenter.java


示例5: setChart1Value

import com.github.mikephil.charting.utils.EntryXComparator; //导入依赖的package包/类
/**
 * Used to display the value from the measure list into the chart
 * @param measures The list of the measure we want to display
 * @param labelName The label we want to display for each value under the graph
 */
private void setChart1Value(List<Measure> measures, String labelName,String dateFormat, CustomRules rule) {


    chart=(LineChart) view.findViewById(R.id.chart_measure);
    if (measures.size()==0)
        return;
    //data for the entry
    List<Entry> dataEntries=new ArrayList<>();

    //get the data based on measure
    for (int k=0;k<measures.size();k++)
    {   //add the entry
        dataEntries.add(new Entry(k,measures.get(k).getValue1().floatValue()));
        //enter the fix value related to the rule
    }
    //add label instead of number in the axis
    chart.notifyDataSetChanged();

    //sort otherwise we will trigger an error
    Collections.sort(dataEntries, new EntryXComparator());
    //add the entry to a data set (data that belong together), it's a line
    LineDataSet dataSet=new LineDataSet(dataEntries,labelName);
    dataSet.setColor(Color.BLUE);
    dataSet.setValueTextColor(Color.BLACK);
    //create a data set for each line

    LineData lineData=new LineData(dataSet);
    chart.setData(lineData);
    //refresh view
    IAxisValueFormatter formatter =new XaxValueFormater(measures,dateFormat);
    //set the gape between value in x axis
    XAxis xAxis = chart.getXAxis();
    xAxis.setGranularity(1f); // minimum axis-step (interval) is 1
    //set the label instead of numner
    xAxis.setValueFormatter(formatter);
    dataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER);


    dataSet.setDrawFilled(true);
    dataSet.setFillColor(Color.BLUE);
    //draw the limite of the allowed value
    setLimites(rule);
    chart.getDescription().setEnabled(false);
    chart.invalidate();

}
 
开发者ID:kflauri2312lffds,项目名称:Android_watch_magpie,代码行数:52,代码来源:Fragment_display_measures.java


示例6: setChart2Value

import com.github.mikephil.charting.utils.EntryXComparator; //导入依赖的package包/类
/**
 * this methode is basicaly the same as the setchart1value1, but it will process 2 value. Used for pressure
 * @param measures the list of the measure we have to display
 * @param labelValue1 the label of the first data set
 * @param labelValue2 the label of the second data set
 */
private void setChart2Value(List<Measure> measures, String labelValue1, String labelValue2,String dateformat, CustomRules rule) {
    if (measures.size()==0)
        return;

    //set the entry for the
    List<Entry> entries_measure1=new ArrayList<>();
    List<Entry>entries_measure2=new ArrayList<>();
    for (int k=0;k<measures.size();k++)
    {   //add the entry
        entries_measure1.add(new Entry(k,measures.get(k).getValue1().floatValue()));
        entries_measure2.add(new Entry(k,measures.get(k).getValue2().floatValue()));
    }

    //add label instead of number in the axis
    chart.notifyDataSetChanged();

    //sort otherwise we will trigger an error
    Collections.sort(entries_measure1, new EntryXComparator());
    Collections.sort(entries_measure2,new EntryXComparator());

    //add the entry to a data set (data that belong together), it's a line

    //************FIRST DATA SET *************************
    LineDataSet dataSet1=new LineDataSet(entries_measure1,labelValue1);
    dataSet1.setColor(Color.BLUE);
    dataSet1.setValueTextColor(Color.BLACK);
    //**************SECOND DATA SET*********************
    LineDataSet dataSet2=new LineDataSet(entries_measure2,labelValue2);
    dataSet2.setColor(Color.GREEN);
    dataSet2.setValueTextColor(Color.BLACK);



    //ad the data set to the line data. Linedata contains all data set
    LineData lineData=new LineData(dataSet1,dataSet2);
    chart.setData(lineData);
    //refresh view
    IAxisValueFormatter formatter =new XaxValueFormater(measures,dateformat);
    //set the gape between value in x axis
    XAxis xAxis = chart.getXAxis();
    xAxis.setGranularity(1f); // minimum axis-step (interval) is 1
    //set the label instead of numner
    xAxis.setValueFormatter(formatter);
    dataSet1.setMode(LineDataSet.Mode.CUBIC_BEZIER);

    //draw the limite of the allowed value
    setLimites(rule);
    dataSet1.setDrawFilled(true);
    dataSet1.setFillColor(Color.BLUE);

    dataSet2.setDrawFilled(true);
    dataSet2.setFillColor(Color.GREEN);

    chart.notifyDataSetChanged();
    chart.invalidate();

}
 
开发者ID:kflauri2312lffds,项目名称:Android_watch_magpie,代码行数:64,代码来源:Fragment_display_measures.java



注:本文中的com.github.mikephil.charting.utils.EntryXComparator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SLSRunner类代码示例发布时间:2022-05-23
下一篇:
Java EntityIronGolem类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap