当前位置: 首页>>代码示例>>Java>>正文


Java CombinedData类代码示例

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


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

示例1: prepareLegend

import com.github.mikephil.charting.data.CombinedData; //导入依赖的package包/类
/**
 * Create a legend based on a dummy chart.  The legend
 * is used by all charts and is positioned
 * across the top of the screen.
 * @param data - CombinedData used to generate the legend
 */
private void prepareLegend(final CombinedData data){
  //The dummy chart is never shown, but it's legend is.
  final CombinedChart dummyChart = (CombinedChart) mRoot.findViewById(R.id.legend);
  dummyChart.getPaint(Chart.PAINT_DESCRIPTION).setTextAlign(Paint.Align.CENTER);
  dummyChart.getXAxis().setEnabled(false);
  dummyChart.getAxisRight().setEnabled(false);
  dummyChart.getAxisLeft().setEnabled(false);
  final Description description = new Description();
  description.setText("");
  description.setTextSize(10f);
  dummyChart.setDescription(description);
  dummyChart.setBackgroundColor(Color.WHITE);
  dummyChart.setDrawGridBackground(false);
  dummyChart.setData(data);

  final Legend l = dummyChart.getLegend();
  l.setEnabled(true);
  // The positioning of the legend effectively
  // hides the dummy chart from view.
  l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
  l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
  dummyChart.invalidate();
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:30,代码来源:SummaryChartFragment.java

示例2: buildDummyDataForLegend

import com.github.mikephil.charting.data.CombinedData; //导入依赖的package包/类
/**
 * Create dataset to be displayed in chart legend
 * @return CombinedData representing dummy data for a legend
 */
private CombinedData buildDummyDataForLegend(){
  CombinedData combinedData = new CombinedData();
  float xIndex = 1.5f;
  float close = 13;
  float open = 26f;
  float shadowH = 30.33f;
  float shadowL = -2.05f;
  float average = 20f;
  CandleData candleData = generateCandleData(xIndex, shadowH, shadowL, open, close, "EMU HI/LO" );
  ScatterData scatterData = generateScatterData(average, "EMU Mean");

  LineData s1 = generateOceanHiLo(close, open, "Ocean HI/LO");
  combinedData.setData(s1);
  combinedData.setData(candleData);
  combinedData.setData(scatterData);
  return combinedData;
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:22,代码来源:SummaryChartPresenter.java

示例3: buildTempData

import com.github.mikephil.charting.data.CombinedData; //导入依赖的package包/类
/**
 * Build a CombinedData object containing temperature data
 * @param observation - EMUObservation
 * @param stat - EMUStat
 * @return - CombinedData
 */
private CombinedData buildTempData(EMUObservation observation, EMUStat stat){
  CombinedData combinedData = new CombinedData();
  if (stat.getTemp_max() == null || stat.getTemp_min() == null || stat.getTemp_mean() == null || observation.getTemperature() == null){
    return combinedData;
  }
  float xIndex = 1.5f;
  float close = (float) stat.getTemp_min().doubleValue();
  float open = (float) stat.getTemp_max().doubleValue();
  float shadowH = (float)mDataManager.getMaxTemperatureFromSummary().doubleValue();   // 30.33f; // Greatest max temp from summary table
  float shadowL = (float) mDataManager.getMinTemperatureFromSummary().doubleValue();  // -2.05f; // Lowest min temp from summary table

  float averageTemp = (float)observation.getTemperature().doubleValue();
  Log.i("SummaryChartPresenter", "Temperature: Ocean high = " + shadowH + " ocean low = "+ shadowL + " emu min = " + close + " emu max = "+ open + " emu mean for location = "+ averageTemp);

  combinedData.setData(generateCandleData(xIndex, shadowH, shadowL, open, close, TEMPERATURE ));
  ScatterData sdata = generateScatterData(averageTemp, TEMPERATURE);
  combinedData.setData(sdata);
  return  combinedData;
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:26,代码来源:SummaryChartPresenter.java

示例4: buildSalinityData

import com.github.mikephil.charting.data.CombinedData; //导入依赖的package包/类
/**
 * Build a CombinedData object containing salinity data
 * @param observation - EMUObservation
 * @param stat - EMUStat
 * @return - CombinedData
 */
private CombinedData buildSalinityData(EMUObservation observation, EMUStat stat){
  CombinedData combinedData = new CombinedData();
  if (stat.getSalinity_max() == null || stat.getSalinity_min() == null || stat.getSalinity_mean() == null || observation.getSalinity() == null){
    return combinedData;
  }
  float xIndex = 1.5f;
  float close = (float) stat.getSalinity_min().doubleValue();
  float open = (float) stat.getSalinity_max().doubleValue();
  float shadowH = (float)mDataManager.getMaxSalinityFromSummary().doubleValue();
  float shadowL = (float) mDataManager.getMinSalinityFromSummary().doubleValue();

  float avgSalinity = (float)observation.getSalinity().doubleValue();
  Log.i("SummaryChartPreseter", "Salinity: Ocean high = " + shadowH + " ocean low = "+ shadowL + " emu min = " + close + " emu max = "+ open + " emu mean for location = "+ avgSalinity);

  combinedData.setData(generateCandleData(xIndex, shadowH, shadowL, open, close, SALINITY ));
  combinedData.setData(generateScatterData(avgSalinity, SALINITY));
  return  combinedData;
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:25,代码来源:SummaryChartPresenter.java

示例5: buildOxygenData

import com.github.mikephil.charting.data.CombinedData; //导入依赖的package包/类
/**
 * Build a CombinedData object containing oxygen data
 * @param observation - EMUObservation
 * @param stat - EMUStat
 * @return - CombinedData
 */
private CombinedData buildOxygenData(EMUObservation observation, EMUStat stat){

  CombinedData combinedData = new CombinedData();
  if (stat.getDisso2_max() == null || stat.getDisso2_min() == null || stat.getDisso2_mean() == null || observation.getOxygen() == null){
    return combinedData;
  }
  float xIndex = 1.5f;
  float close = (float) stat.getDisso2_min().doubleValue();
  float open = (float) stat.getDisso2_max().doubleValue();
  float shadowH = (float)mDataManager.getMaxOxygenFromSummary().doubleValue();
  float shadowL = (float) mDataManager.getMinOxygenFromSummary().doubleValue();

  float averageOx = (float)observation.getOxygen().doubleValue();
  Log.i("SummaryChartPreseter", "Oxygen: Ocean high = " + shadowH + " ocean low = "+ shadowL + " emu min = " + close + " emu max = "+ open + " emu mean for location = "+ averageOx);

  combinedData.setData(generateCandleData(xIndex, shadowH, shadowL, open, close, OXYGEN ));
  combinedData.setData(generateScatterData(averageOx, OXYGEN));
  return  combinedData;
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:26,代码来源:SummaryChartPresenter.java

示例6: buildPhosphateData

import com.github.mikephil.charting.data.CombinedData; //导入依赖的package包/类
/**
 * Build a CombinedData object containing phosphate data
 * @param observation - EMUObservation
 * @param stat - EMUStat
 * @return - CombinedData
 */
private CombinedData buildPhosphateData(EMUObservation observation, EMUStat stat){
  CombinedData combinedData = new CombinedData();
  if (stat.getPhosphate_max() == null || stat.getPhosphate_min() == null || stat.getPhosphate_mean() == null || observation.getPhosphate() == null){
    return combinedData;
  }
  float xIndex = 1.5f;
  float close = (float) stat.getPhosphate_min().doubleValue();
  float open = (float) stat.getPhosphate_max().doubleValue();
  float shadowH = (float)mDataManager.getMaxPhosphateFromSummary().doubleValue();
  float shadowL = (float) mDataManager.getMinPhosphateFromSummary().doubleValue();

  float averagePhos = (float)observation.getPhosphate().doubleValue();
  Log.i("SummaryChartPreseter", "Phosphate: Ocean high = " + shadowH + " ocean low = "+ shadowL + " emu min = " + close + " emu max = "+ open + " emu mean for location = "+ averagePhos);

  combinedData.setData(generateCandleData(xIndex, shadowH, shadowL, open, close, PHOSPHATE ));
  combinedData.setData(generateScatterData(averagePhos, PHOSPHATE));
  return  combinedData;
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:25,代码来源:SummaryChartPresenter.java

示例7: buildSilicateData

import com.github.mikephil.charting.data.CombinedData; //导入依赖的package包/类
/**
 * Build a CombinedData object containing silicate data
 * @param observation - EMUObservation
 * @param stat - EMUStat
 * @return - CombinedData
 */
private CombinedData buildSilicateData(EMUObservation observation, EMUStat stat){
  CombinedData combinedData = new CombinedData();
  if (stat.getSilicate_max() == null || stat.getSilicate_min() == null || stat.getSilicate_mean() == null || observation.getSilicate() == null){
    return combinedData;
  }
  float xIndex = 1.5f;
  float close = (float) stat.getSilicate_min().doubleValue();
  float open = (float) stat.getSilicate_max().doubleValue();
  float shadowH = (float)mDataManager.getMaxSilicateFromSummary().doubleValue();
  float shadowL = (float) mDataManager.getMinSilicateFromSummary().doubleValue();

  float averageSil = (float)observation.getSilicate().doubleValue();
  Log.i("SummaryChartPreseter", "Silicate: Ocean high = " + shadowH + " ocean low = "+ shadowL + " emu min = " + close + " emu max = "+ open + " emu mean for location = "+ averageSil);

  combinedData.setData(generateCandleData(xIndex, shadowH, shadowL, open, close, SILICATE ));
  combinedData.setData(generateScatterData(averageSil, SILICATE));
  return  combinedData;
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:25,代码来源:SummaryChartPresenter.java

示例8: buildNitrateData

import com.github.mikephil.charting.data.CombinedData; //导入依赖的package包/类
/**
 * Build a CombinedData object containing nitrate data
 * @param observation - EMUObservation
 * @param stat - EMUStat
 * @return - CombinedData
 */
private CombinedData buildNitrateData(EMUObservation observation, EMUStat stat){
  CombinedData combinedData = new CombinedData();
  if (stat.getNitrate_min() == null || stat.getNitrate_max() == null || stat.getNitrate_mean() == null || observation.getNitrate() == null){
    return combinedData;
  }
  float xIndex = 1.5f;
  float close = (float) stat.getNitrate_min().doubleValue();
  float open = (float) stat.getNitrate_max().doubleValue();
  float shadowH = (float)mDataManager.getMaxNitrateFromSummary().doubleValue();
  float shadowL = (float) mDataManager.getMinNitrateFromSummary().doubleValue();

  float averageN = (float)observation.getNitrate().doubleValue();
  Log.i("SummaryChartPreseter", "Nitrate: Ocean high = " + shadowH + " ocean low = "+ shadowL + " emu min = " + close + " emu max = "+ open + " emu mean for location = "+ averageN);

  combinedData.setData(generateCandleData(xIndex, shadowH, shadowL, open, close, NITRATE ));
  combinedData.setData(generateScatterData(averageN, NITRATE));
  return combinedData;
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:25,代码来源:SummaryChartPresenter.java

示例9: setData

import com.github.mikephil.charting.data.CombinedData; //导入依赖的package包/类
@Override
public void setData(CombinedData data) {
    super.setData(data);
    setHighlighter(new CombinedHighlighter(this, this));
    ((CombinedChartRenderer)mRenderer).createRenderers();
    mRenderer.initBuffers();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:CombinedChart.java

示例10: drawHighlighted

import com.github.mikephil.charting.data.CombinedData; //导入依赖的package包/类
@Override
public void drawHighlighted(Canvas c, Highlight[] indices) {

    Chart chart = mChart.get();
    if (chart == null) return;

    for (DataRenderer renderer : mRenderers) {
        ChartData data = null;

        if (renderer instanceof BarChartRenderer)
            data = ((BarChartRenderer)renderer).mChart.getBarData();
        else if (renderer instanceof LineChartRenderer)
            data = ((LineChartRenderer)renderer).mChart.getLineData();
        else if (renderer instanceof CandleStickChartRenderer)
            data = ((CandleStickChartRenderer)renderer).mChart.getCandleData();
        else if (renderer instanceof ScatterChartRenderer)
            data = ((ScatterChartRenderer)renderer).mChart.getScatterData();
        else if (renderer instanceof BubbleChartRenderer)
            data = ((BubbleChartRenderer)renderer).mChart.getBubbleData();

        int dataIndex = data == null ? -1
                : ((CombinedData)chart.getData()).getAllData().indexOf(data);

        mHighlightBuffer.clear();

        for (Highlight h : indices) {
            if (h.getDataIndex() == dataIndex || h.getDataIndex() == -1)
                mHighlightBuffer.add(h);
        }

        renderer.drawHighlighted(c, mHighlightBuffer.toArray(new Highlight[mHighlightBuffer.size()]));
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:34,代码来源:CombinedChartRenderer.java

示例11: onCreate

import com.github.mikephil.charting.data.CombinedData; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_combined);

        mChart = (CombinedChart) findViewById(R.id.chart1);
        mChart.setDescription("");
        mChart.setBackgroundColor(Color.WHITE);
        mChart.setDrawGridBackground(false);
        mChart.setDrawBarShadow(false);
        
        // draw bars behind lines
        mChart.setDrawOrder(new DrawOrder[] {
                DrawOrder.BAR, DrawOrder.BUBBLE, DrawOrder.CANDLE, DrawOrder.LINE, DrawOrder.SCATTER
        });

        YAxis rightAxis = mChart.getAxisRight();
        rightAxis.setDrawGridLines(false);
        rightAxis.setAxisMinValue(0f); // this replaces setStartAtZero(true)

        YAxis leftAxis = mChart.getAxisLeft();
        leftAxis.setDrawGridLines(false);
        leftAxis.setAxisMinValue(0f); // this replaces setStartAtZero(true)

        XAxis xAxis = mChart.getXAxis();
        xAxis.setPosition(XAxisPosition.BOTH_SIDED);

        CombinedData data = new CombinedData(mMonths);

        data.setData(generateLineData());
        data.setData(generateBarData());
//        data.setData(generateBubbleData());
//         data.setData(generateScatterData());
//         data.setData(generateCandleData());

        mChart.setData(data);
        mChart.invalidate();
    }
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:41,代码来源:CombinedChartActivity.java

示例12: drawHighlighted

import com.github.mikephil.charting.data.CombinedData; //导入依赖的package包/类
@Override
public void drawHighlighted(Canvas c, Highlight[] indices) {

    Chart chart = mChart.get();
    if (chart == null) return;

    for (DataRenderer renderer : mRenderers) {
        ChartData data = null;

        if (renderer instanceof BarChartRenderer)
            data = ((BarChartRenderer)renderer).mChart.getBarData();
        else if (renderer instanceof LineChartRenderer)
            data = ((LineChartRenderer)renderer).mChart.getLineData();
        else if (renderer instanceof CandleStickChartRenderer)
            data = ((CandleStickChartRenderer)renderer).mChart.getCandleData();
        else if (renderer instanceof ScatterChartRenderer)
            data = ((ScatterChartRenderer)renderer).mChart.getScatterData();
        else if (renderer instanceof BubbleChartRenderer)
            data = ((BubbleChartRenderer)renderer).mChart.getBubbleData();

        int dataIndex = data == null
                ? -1
                : ((CombinedData)chart.getData()).getAllData().indexOf(data);

        ArrayList<Highlight> dataIndices = new ArrayList<>();
        for (Highlight h : indices) {
            if (h.getDataIndex() == dataIndex || h.getDataIndex() == -1)
                dataIndices.add(h);
        }

        renderer.drawHighlighted(c, dataIndices.toArray(new Highlight[dataIndices.size()]));

    }
}
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:35,代码来源:CombinedChartRenderer.java

示例13: getSelectionDetailsAtIndex

import com.github.mikephil.charting.data.CombinedData; //导入依赖的package包/类
/**
 * Returns a list of SelectionDetail object corresponding to the given xIndex.
 *
 * @param xIndex
 * @return
 */
@Override
protected List<SelectionDetail> getSelectionDetailsAtIndex(int xIndex, int dataSetIndex) {

    List<SelectionDetail> vals = new ArrayList<SelectionDetail>();
    float[] pts = new float[2];

    CombinedData data = (CombinedData) mChart.getData();

    // get all chartdata objects
    List<ChartData> dataObjects = data.getAllData();

    for (int i = 0; i < dataObjects.size(); i++) {

        for(int j = 0; j < dataObjects.get(i).getDataSetCount(); j++) {

            IDataSet dataSet = dataObjects.get(i).getDataSetByIndex(j);

            // dont include datasets that cannot be highlighted
            if (!dataSet.isHighlightEnabled())
                continue;

            // extract all y-values from all DataSets at the given x-index
            final float yVals[] = dataSet.getYValsForXIndex(xIndex);
            for (float yVal : yVals) {
                pts[1] = yVal;

                mChart.getTransformer(dataSet.getAxisDependency()).pointValuesToPixel(pts);

                if (!Float.isNaN(pts[1])) {
                    vals.add(new SelectionDetail(pts[1], yVal, i, j, dataSet));
                }
            }
        }
    }

    return vals;
}
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:44,代码来源:CombinedHighlighter.java

示例14: showWaterProfiles

import com.github.mikephil.charting.data.CombinedData; //导入依赖的package包/类
/**
 * Set the data for the adapter
 * @param dataList - List<CombinedData> containing data points
 */
@Override public void showWaterProfiles(final List<CombinedData> dataList ) {
  //
  // Because this FragmentPagerAdapter is being used within a nested
  // fragment, we don't want to use the shared fragment manager.
  // USE A NEW INSTANCE OF THE FRAGMENT MANAGER rather than
  // using the fragment manager belonging to the activity.
  //
  TabPagerAdapter adapter = new TabPagerAdapter(getChildFragmentManager(), dataList);
  mViewPager.setAdapter(adapter);
  mViewPager.getAdapter().notifyDataSetChanged();

}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:17,代码来源:WaterProfileFragment.java

示例15: showChartData

import com.github.mikephil.charting.data.CombinedData; //导入依赖的package包/类
/**
 * Display chart data
 * @param dataList - List<CombinedData> for populating charts
 */
@Override public void showChartData(final List<CombinedData> dataList) {
  if (dataList != null){
    final int size = dataList.size();
    for (int x = 0; x < (size - 1); x++){
      final CombinedData data = dataList.get(x);
      final int viewId = getIdForChartView(x);
      prepareChartView(viewId, data);
    }
    prepareLegend(dataList.get(size -1));
  }
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:16,代码来源:SummaryChartFragment.java


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