Java 类com.github.mikephil.charting.data.ChartData 实例源码

项目:Stayfit    文件:SimpleFragment.java   
protected BarData generateBarData(int dataSets, float range, int count) {

        ArrayList<IBarDataSet> sets = new ArrayList<IBarDataSet>();

        for(int i = 0; i < dataSets; i++) {

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

//            entries = FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "stacked_bars.txt");

            for(int j = 0; j < count; j++) {        
                entries.add(new BarEntry((float) (Math.random() * range) + range / 4, j));
            }

            BarDataSet ds = new BarDataSet(entries, getLabel(i));
            ds.setColors(ColorTemplate.VORDIPLOM_COLORS);
            sets.add(ds);
        }

        BarData d = new BarData(ChartData.generateXVals(0, count), sets);
        d.setValueTypeface(tf);
        return d;
    }
项目:Stayfit    文件:SimpleFragment.java   
protected ScatterData generateScatterData(int dataSets, float range, int count) {

    ArrayList<IScatterDataSet> sets = new ArrayList<IScatterDataSet>();

    ScatterShape[] shapes = ScatterChart.getAllPossibleShapes();

    for(int i = 0; i < dataSets; i++) {

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

        for(int j = 0; j < count; j++) {        
            entries.add(new Entry((float) (Math.random() * range) + range / 4, j));
        }

        ScatterDataSet ds = new ScatterDataSet(entries, getLabel(i));
        ds.setScatterShapeSize(12f);
        ds.setScatterShape(shapes[i % shapes.length]);
        ds.setColors(ColorTemplate.COLORFUL_COLORS);
        ds.setScatterShapeSize(9f);
        sets.add(ds);
    }

    ScatterData d = new ScatterData(ChartData.generateXVals(0, count), sets);
    d.setValueTypeface(tf);
    return d;
}
项目:GitHub    文件:CombinedChartRenderer.java   
@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()]));
    }
}
项目:DOUSalaries    文件:ChartHelper.java   
/**
 * Set the pie pattern
 * @param pieChart chart
 * @param chartData pie chart data
 * @param title chart title
 * @param tf Typeface font
 */
public static void setPieChart(PieChart pieChart, ChartData<?> chartData,
                               SpannableString title, Typeface tf) {
    chartData.setValueFormatter(new PercentFormatter());
    chartData.setValueTextSize(11f);
    chartData.setValueTextColor(Color.BLACK);
    chartData.setValueTypeface(tf);

    pieChart.setUsePercentValues(true);
    pieChart.getDescription().setEnabled(false);
    pieChart.setExtraOffsets(5, 10, 5, 5);
    pieChart.setDragDecelerationFrictionCoef(0.95f);
    pieChart.setCenterTextTypeface(tf);
    pieChart.setCenterText(title);
    pieChart.setExtraOffsets(20.f, 0.f, 20.f, 0.f);
    pieChart.setDrawHoleEnabled(true);
    pieChart.setHoleColor(Color.WHITE);
    pieChart.setTransparentCircleColor(Color.WHITE);
    pieChart.setTransparentCircleAlpha(110);
    pieChart.setHoleRadius(58f);
    pieChart.setTransparentCircleRadius(61f);
    pieChart.setDrawCenterText(true);
    pieChart.setRotationAngle(0);
    pieChart.setRotationEnabled(true);// enable rotation of the chart by touch
    pieChart.setHighlightPerTapEnabled(true);
    pieChart.setEntryLabelTextSize(10f);

    Legend l = pieChart.getLegend();
    l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
    l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
    l.setOrientation(Legend.LegendOrientation.VERTICAL);
    l.setDrawInside(false);
    l.setEnabled(false);

    pieChart.setData((PieData) chartData);
    pieChart.animateY(DURATION_MEDIUM, Easing.EasingOption.EaseInOutQuad);
    pieChart.highlightValues(null);// undo all highlights
    pieChart.invalidate();

}
项目:DOUSalaries    文件:ChartHelper.java   
/**
 * Set the line chart pattern
 * @param lineChart chart
 * @param chartData pie chart data
 * @param month data
 * @param typeface Typeface font
 */
public static void setLineChart(Context context, LineChart lineChart, ChartData<?> chartData,
                                final String[] month, Typeface typeface) {
    // apply styling
    lineChart.getDescription().setEnabled(false);
    lineChart.setDrawGridBackground(false);
    // create a custom MarkerView (extend MarkerView) and specify the layout to use for it
    SalaryMarker marker = new SalaryMarker(context, R.layout.marker_salary_detail);
    marker.setChartView(lineChart); // For bounds control
    lineChart.setMarker(marker);
    //fix crash com.github.mikephil.charting.charts.Chart.drawMarkers(Chart.java:731)
    lineChart.setDrawMarkers(false);

    XAxis xAxis = lineChart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setTypeface(typeface);
    xAxis.setDrawGridLines(false);
    xAxis.setDrawAxisLine(true);
    xAxis.setValueFormatter(new LineChartValueFormatter(month));
    xAxis.setLabelCount(month.length / 2, true);//xAxis label count

    YAxis leftAxis = lineChart.getAxisLeft();
    leftAxis.setTypeface(typeface);
    leftAxis.setLabelCount(9, false);
    leftAxis.setAxisMinimum(0f);
    YAxis rightAxis = lineChart.getAxisRight();
    rightAxis.setTypeface(typeface);
    rightAxis.setDrawGridLines(false);
    rightAxis.setAxisMinimum(0f);
    Legend l = lineChart.getLegend();
    l.setWordWrapEnabled(true);
    l.setTypeface(typeface);
    l.setFormSize(14f);
    l.setTextSize(9f);
    lineChart.setData((LineData) chartData);
    lineChart.animateX(DURATION_SHORT);

}
项目:DOUSalaries    文件:ChartHelper.java   
/**
 * Set the horizontal bar pattern
 * @param barChart chart
 * @param chartData horizontal bar chart data
 * @param jobs string array of job titles
 * @param typeface Typeface font
 */
public static void setHorizontalBarChart(BarChart barChart, final ChartData<?> chartData,
                                         final String[] jobs, Typeface typeface) {
    barChart.setDrawGridBackground(false);
    XAxis xAxis = barChart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    //xAxis.setLabelCount(chartData.getEntryCount());
    xAxis.setLabelCount(jobs.length);
    xAxis.setTypeface(typeface);
    xAxis.setDrawAxisLine(true);
    xAxis.setDrawGridLines(false);
    xAxis.setGranularity(1f);

    YAxis leftAxis = barChart.getAxisLeft();
    leftAxis.setTypeface(typeface);
    leftAxis.setSpaceTop(15f);
    leftAxis.setAxisMinimum(0f);
    leftAxis.setGranularity(1f);
    leftAxis.setDrawAxisLine(true);
    leftAxis.setDrawGridLines(true);
    YAxis axisRight = barChart.getAxisRight();
    axisRight.setTypeface(typeface);
    axisRight.setDrawAxisLine(true);
    axisRight.setDrawGridLines(false);
    axisRight.setGranularity(1f);
    axisRight.setAxisMinimum(0f);

    final Legend legend = barChart.getLegend();
    legend.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
    legend.setHorizontalAlignment(Legend.LegendHorizontalAlignment.LEFT);
    legend.setOrientation(Legend.LegendOrientation.HORIZONTAL);
    legend.setDrawInside(false);
    legend.setFormSize(8f);
    legend.setXEntrySpace(4f);
    barChart.setData((BarData) chartData);
    barChart.setFitBars(true);
    barChart.animateY(DURATION_LONG);
    xAxis.setValueFormatter(new HorizontalBarValueFormatter(jobs));
}
项目:DOUSalaries    文件:ChartHelper.java   
/**
 * Set the vertical bar  pattern
 * @param barChart chart
 * @param chartData pie chart data
 * @param typeface Typeface font
 */
public static void setVerticalBarChart(Context context, BarChart barChart, ChartData<?> chartData,
                                        Typeface typeface) {
    // create a custom MarkerView (extend MarkerView) and specify the layout to use for it
    ExperienceMarker marker = new ExperienceMarker(context, R.layout.marker_exp_age);
    marker.setChartView(barChart); // For bounds control
    barChart.setMarker(marker);
    //fix crash com.github.mikephil.charting.charts.Chart.drawMarkers(Chart.java:731)
    barChart.setDrawMarkers(false);

    barChart.getDescription().setEnabled(false);
    barChart.setDrawGridBackground(false);
    barChart.setDrawBarShadow(false);
    XAxis xAxis = barChart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    //Sets the number of labels for the x-axis (display all the x-axis values)
   // xAxis.setLabelCount(chartData.getEntryCount());
    xAxis.setTypeface(typeface);
    xAxis.setDrawGridLines(false);
    xAxis.setDrawAxisLine(true);
    YAxis leftAxis = barChart.getAxisLeft();
    leftAxis.setTypeface(typeface);
    leftAxis.setSpaceTop(20f);
    leftAxis.setAxisMinimum(0f);

    YAxis rightAxis = barChart.getAxisRight();
    rightAxis.setTypeface(typeface);
    rightAxis.setSpaceTop(20f);
    rightAxis.setAxisMinimum(0f);
    chartData.setValueTypeface(typeface);
    barChart.setData((BarData) chartData);
    barChart.setFitBars(true);
    barChart.animateY(DURATION_SHORT);
}
项目:DOUSalaries    文件:GroupBarChartItem.java   
public GroupBarChartItem(Context context, ChartData<?> chartData ) {
    super(chartData);
    this.context = context;
    this.typeface = Typeface.createFromAsset(context.getAssets(), "fonts/OpenSans-Regular.ttf");
    this.language = "";
    this.start = 0;
}
项目:DOUSalaries    文件:HorizontalBarChartItem.java   
public HorizontalBarChartItem(Context context, ChartData<?> chartData) {
    super(chartData);
    this.typeface = Typeface.createFromAsset(context.getAssets(), "fonts/OpenSans-Regular.ttf");
    this.jobTitles = AppUtils.reverseArray(
            context.getResources().getStringArray(R.array.array_job_title));
    this.title = "";
}
项目:DOUSalaries    文件:LineChartItem.java   
public LineChartItem(Context context, ChartData<?> chartData, String language) {
    super(chartData);
    this.typeface = Typeface.createFromAsset(context.getAssets(), "fonts/OpenSans-Regular.ttf");
    this.context = context;
    this.title = language;
    this.month = AppUtils.reverseArray(
            context.getResources().getStringArray(R.array.array_period_date));
}
项目:Stayfit    文件:SimpleFragment.java   
protected LineData generateLineData() {

//        DataSet ds1 = new DataSet(n, "O(n)");  
//        DataSet ds2 = new DataSet(nlogn, "O(nlogn)"); 
//        DataSet ds3 = new DataSet(nsquare, "O(n\u00B2)");
//        DataSet ds4 = new DataSet(nthree, "O(n\u00B3)");

        ArrayList<ILineDataSet> sets = new ArrayList<ILineDataSet>();

        LineDataSet ds1 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "sine.txt"), "Sine function");
        LineDataSet ds2 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "cosine.txt"), "Cosine function");

        ds1.setLineWidth(2f);
        ds2.setLineWidth(2f);

        ds1.setDrawCircles(false);
        ds2.setDrawCircles(false);

        ds1.setColor(ColorTemplate.VORDIPLOM_COLORS[0]);
        ds2.setColor(ColorTemplate.VORDIPLOM_COLORS[1]);

        // load DataSets from textfiles in assets folders
        sets.add(ds1);
        sets.add(ds2);

//        sets.add(FileUtils.dataSetFromAssets(getActivity().getAssets(), "n.txt"));
//        sets.add(FileUtils.dataSetFromAssets(getActivity().getAssets(), "nlogn.txt"));
//        sets.add(FileUtils.dataSetFromAssets(getActivity().getAssets(), "square.txt"));
//        sets.add(FileUtils.dataSetFromAssets(getActivity().getAssets(), "three.txt"));

        int max = Math.max(sets.get(0).getEntryCount(), sets.get(1).getEntryCount());

        LineData d = new LineData(ChartData.generateXVals(0, max),  sets);
        d.setValueTypeface(tf);
        return d;
    }
项目:Stayfit    文件:SimpleFragment.java   
protected LineData getComplexity() {

    ArrayList<ILineDataSet> sets = new ArrayList<ILineDataSet>();

    LineDataSet ds1 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "n.txt"), "O(n)");
    LineDataSet ds2 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "nlogn.txt"), "O(nlogn)");
    LineDataSet ds3 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "square.txt"), "O(n\u00B2)");
    LineDataSet ds4 = new LineDataSet(FileUtils.loadEntriesFromAssets(getActivity().getAssets(), "three.txt"), "O(n\u00B3)");

    ds1.setColor(ColorTemplate.VORDIPLOM_COLORS[0]);
    ds2.setColor(ColorTemplate.VORDIPLOM_COLORS[1]);
    ds3.setColor(ColorTemplate.VORDIPLOM_COLORS[2]);
    ds4.setColor(ColorTemplate.VORDIPLOM_COLORS[3]);

    ds1.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[0]);
    ds2.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[1]);
    ds3.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[2]);
    ds4.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[3]);

    ds1.setLineWidth(2.5f);
    ds1.setCircleRadius(3f);
    ds2.setLineWidth(2.5f);
    ds2.setCircleRadius(3f);
    ds3.setLineWidth(2.5f);
    ds3.setCircleRadius(3f);
    ds4.setLineWidth(2.5f);
    ds4.setCircleRadius(3f);


    // load DataSets from textfiles in assets folders
    sets.add(ds1);        
    sets.add(ds2);
    sets.add(ds3);
    sets.add(ds4);

    LineData d = new LineData(ChartData.generateXVals(0, ds1.getEntryCount()), sets);
    d.setValueTypeface(tf);
    return d;
}
项目:NetKnight    文件:CombinedChartRenderer.java   
@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()]));

    }
}
项目:NetKnight    文件:CombinedHighlighter.java   
/**
 * 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;
}
项目:react-native-mp-android-chart    文件:ChartBaseManager.java   
/**
 *
 * Dataset config details: https://github.com/PhilJay/MPAndroidChart/wiki/DataSet-classes-in-detail
 */
@ReactProp(name = "data")
public void setData(Chart chart, ReadableMap propMap) {
    if (!BridgeUtils.validate(propMap, ReadableType.Array, "datasets")) {
        return;
    }

    String[] xValues = new String[0];
    if (BridgeUtils.validate(propMap, ReadableType.Array, "xValues")) {
        xValues = BridgeUtils.convertToStringArray(propMap.getArray("xValues"));
    }

    ChartData<IDataSet<U>> chartData = createData(xValues);

    ReadableArray datasets = propMap.getArray("datasets");
    for (int i = 0; i < datasets.size(); i++) {
        ReadableMap dataset = datasets.getMap(i);

        // TODO validation
        ReadableArray yValues = dataset.getArray("yValues");
        String label = dataset.getString("label");

        ArrayList<U> entries = createEntries(yValues);

        IDataSet<U> lineDataSet = createDataSet(entries, label);

        if (BridgeUtils.validate(dataset, ReadableType.Map, "config")) {
            dataSetConfig(lineDataSet, dataset.getMap("config"));
        }

        chartData.addDataSet(lineDataSet);
    }

    chart.setData(chartData);
    chart.invalidate();
}
项目:xs-android-architecture    文件:CombinedChartRenderer.java   
@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()]));
    }
}
项目:LETO-Toggl_Android    文件:CombinedChartRenderer.java   
@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()]));
    }
}
项目:gadgetbridge_artikcloud    文件:LiveActivityFragment.java   
private void addEntries() {
    mTotalStepsChart.setSingleEntryYValue(mSteps.getTotalSteps());
    YAxis stepsPerMinuteCurrentYAxis = mStepsPerMinuteCurrentChart.getAxisLeft();
    int maxStepsPerMinute = mSteps.getMaxStepsPerMinute();
    LimitLine target = new LimitLine(maxStepsPerMinute);
    stepsPerMinuteCurrentYAxis.removeAllLimitLines();
    stepsPerMinuteCurrentYAxis.addLimitLine(target);

    int stepsPerMinute = mSteps.getStepsPerMinute(true);
    mStepsPerMinuteCurrentChart.setSingleEntryYValue(stepsPerMinute);

    if (!addHistoryDataSet(false)) {
        return;
    }

    ChartData data = mStepsPerMinuteHistoryChart.getData();
    data.addXValue("");
    if (stepsPerMinute < 0) {
        stepsPerMinute = 0;
    }
    mHistorySet.addEntry(new Entry(stepsPerMinute, data.getXValCount() - 1));
    int hr = getCurrentHeartRate();
    if (hr < 0) {
        hr = 0;
    }
    mHeartRateSet.addEntry(new Entry(hr, data.getXValCount() - 1));
}
项目:MPAndroidChart    文件:CombinedChartRenderer.java   
@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()]));
    }
}
项目:GitHub    文件:RealmBaseActivity.java   
protected void styleData(ChartData data) {
    data.setValueTypeface(mTf);
    data.setValueTextSize(8f);
    data.setValueTextColor(Color.DKGRAY);
    data.setValueFormatter(new PercentFormatter());
}
项目:GitHub    文件:ChartItem.java   
public ChartItem(ChartData<?> cd) {
    this.mChartData = cd;      
}
项目:GitHub    文件:PieChartItem.java   
public PieChartItem(ChartData<?> cd, Context c) {
    super(cd);

    mTf = Typeface.createFromAsset(c.getAssets(), "OpenSans-Regular.ttf");
    mCenterText = generateCenterText();
}
项目:GitHub    文件:LineChartItem.java   
public LineChartItem(ChartData<?> cd, Context c) {
    super(cd);

    mTf = Typeface.createFromAsset(c.getAssets(), "OpenSans-Regular.ttf");
}
项目:GitHub    文件:BarChartItem.java   
public BarChartItem(ChartData<?> cd, Context c) {
    super(cd);

    mTf = Typeface.createFromAsset(c.getAssets(), "OpenSans-Regular.ttf");
}
项目:Rabbitqueue    文件:ChartItem.java   
public ChartItem(ChartData<?> cd) {
    this.mChartData = cd;      
}
项目:Rabbitqueue    文件:LineChartItem.java   
public LineChartItem(ChartData<?> cd, Context c, float maxValue) {
    super(cd);
    this.maxValue = maxValue;
}
项目:DOUSalaries    文件:ChartHelper.java   
/**
 * Set the pie pattern
 * @param barChart chart
 * @param chartData pie chart data
 * @param context context
 * @param typeface Typeface font
 */
public static void setGroupBarChart(Context context, BarChart barChart, ChartData<?> chartData,
                                 Typeface typeface) {
    barChart.getDescription().setEnabled(false);
    // scaling can now only be done on x- and y-axis separately
    barChart.setPinchZoom(false);
    barChart.setDrawBarShadow(false);
    barChart.setDrawGridBackground(false);
    // create a custom MarkerView (extend MarkerView) and specify the layout to use for it
    SalaryMarker mv = new SalaryMarker(context, R.layout.marker_salary_detail);
    mv.setChartView(barChart); // For bounds control
    barChart.setMarker(mv); // Set the marker to the chart
    barChart.setDrawMarkers(false);

    Legend l = barChart.getLegend();
    l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
    l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
    l.setOrientation(Legend.LegendOrientation.VERTICAL);
    l.setDrawInside(true);
    l.setTypeface(typeface);
    l.setYOffset(0f);
    l.setXOffset(10f);
    l.setYEntrySpace(0f);
    l.setTextSize(8f);

    XAxis xAxis = barChart.getXAxis();
    xAxis.setTypeface(typeface);
    xAxis.setGranularity(1f);
    xAxis.setTextSize(8f);
    xAxis.setCenterAxisLabels(true);
    xAxis.setValueFormatter(new GroupBarValueFormatter());

    YAxis leftAxis = barChart.getAxisLeft();
    leftAxis.setTypeface(typeface);
    leftAxis.setValueFormatter(new LargeValueFormatter());
    leftAxis.setDrawGridLines(false);
    leftAxis.setSpaceTop(35f);
    leftAxis.setAxisMinimum(0f);
    barChart.getAxisRight().setEnabled(false);
    barChart.setData((BarData) chartData);
}
项目:DOUSalaries    文件:VerticalBarChartItem.java   
public VerticalBarChartItem(Context context, ChartData<?> cd) {
    super(cd);
    typeface = Typeface.createFromAsset(context.getAssets(), "fonts/OpenSans-Regular.ttf");
    this.context = context;
    this.title = "";
}
项目:DOUSalaries    文件:ChartItem.java   
public ChartItem(ChartData<?> cd) {
    this.chartData = cd;
}
项目:DOUSalaries    文件:ChartItem.java   
public ChartData<?> getChartData() {
    return chartData;
}
项目:DOUSalaries    文件:PieChartItem.java   
public PieChartItem(Context context, ChartData<?> cd,  String centerText) {
    super(cd);
    this.typeface = Typeface.createFromAsset(context.getAssets(), "fonts/OpenSans-Regular.ttf");
    this.centerText = generateCenterText(centerText);
}
项目:ktball    文件:SchoolAllPeopleDetailAcitivty.java   
public void styleData(ChartData data) {
    data.setValueTypeface(mTy);
    data.setValueTextSize(8f);
    data.setValueTextColor(Color.WHITE);
}
项目:ktball    文件:SchoolContActivity.java   
public void styleData(ChartData data) {
    data.setValueTypeface(mTy);
    data.setValueTextSize(8f);
    data.setValueTextColor(Color.WHITE);
}
项目:ktball    文件:RealmBaseActivity.java   
protected void styleData(ChartData data) {
        data.setValueTypeface(mTf);
        data.setValueTextSize(8f);
        data.setValueTextColor(Color.WHITE);
//        data.setValueFormatter(new PercentFormatter());
    }
项目:Stayfit    文件:RealmBaseActivity.java   
protected void styleData(ChartData data) {
    data.setValueTypeface(mTf);
    data.setValueTextSize(8f);
    data.setValueTextColor(Color.DKGRAY);
    data.setValueFormatter(new PercentFormatter());
}
项目:Stayfit    文件:ChartItem.java   
public ChartItem(ChartData<?> cd) {
    this.mChartData = cd;      
}
项目:Stayfit    文件:PieChartItem.java   
public PieChartItem(ChartData<?> cd, Context c) {
    super(cd);

    mTf = Typeface.createFromAsset(c.getAssets(), "OpenSans-Regular.ttf");
    mCenterText = generateCenterText();
}
项目:Stayfit    文件:LineChartItem.java   
public LineChartItem(ChartData<?> cd, Context c) {
    super(cd);

    mTf = Typeface.createFromAsset(c.getAssets(), "OpenSans-Regular.ttf");
}
项目:Stayfit    文件:BarChartItem.java   
public BarChartItem(ChartData<?> cd, Context c) {
    super(cd);

    mTf = Typeface.createFromAsset(c.getAssets(), "OpenSans-Regular.ttf");
}
项目:react-native-mp-android-chart    文件:BubbleChartManager.java   
@Override
ChartData createData(String[] xValues) {
    return new BubbleData(xValues);
}