Java Code Examples for com.github.mikephil.charting.charts.CombinedChart#setDrawValueAboveBar()

The following examples show how to use com.github.mikephil.charting.charts.CombinedChart#setDrawValueAboveBar() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProgressFragment.java    From voice-pitch-analyzer with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
    public void onViewCreated(View view, Bundle savedInstanceState)
    {
        CombinedChart chart = (CombinedChart) view.findViewById(R.id.progress_chart);
        this.recordings = new RecordingList(this.getContext());

        if (this.recordings != null)
        {
            List<String> dates = this.recordings.getDates();

            CombinedData data = new CombinedData(dates);

            LineDataSet dataSet = new LineDataSet(this.recordings.getGraphEntries(), getResources().getString(R.string.progress));
            LineData lineData = new LineData(dates, dataSet);
            BarData barData = new BarData(dates, GraphLayout.getOverallRange(this.getContext(), dates.size()));

            dataSet.setDrawCubic(true);
            dataSet.enableDashedLine(10, 10, 0);
            dataSet.setLineWidth(3f);
            dataSet.setDrawValues(false);

            dataSet.setCircleColor(getResources().getColor(R.color.canvas_dark));
            dataSet.setColor(getResources().getColor(R.color.canvas_dark));
            dataSet.setCircleSize(5f);

            dataSet.setCubicIntensity(0.05f);
            dataSet.setAxisDependency(YAxis.AxisDependency.LEFT);

            data.setData(lineData);
            data.setData(barData);
            chart.setData(data);
            GraphLayout.FormatChart(chart);

            chart.setTouchEnabled(true);
//            chart.setScaleEnabled(true);
            chart.setPinchZoom(true);
//            chart.setDoubleTapToZoomEnabled(true);

            chart.setDrawValueAboveBar(false);
            chart.setDrawOrder(new DrawOrder[]{
                    DrawOrder.BAR,
                    DrawOrder.BUBBLE,
                    DrawOrder.CANDLE,
                    DrawOrder.LINE,
                    DrawOrder.SCATTER
            });
        }

        super.onViewCreated(view, savedInstanceState);
    }
 
Example 2
Source File: RecordGraphFragment.java    From voice-pitch-analyzer with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState)
{
    CombinedChart chart = (CombinedChart) view.findViewById(R.id.recording_chart);

    pitchDataSet = new LineDataSet(mListener.startingPitchEntries(), getResources().getString(R.string.progress));
    // generate x value strings
    // [1, 2, 3,... basically random numbers as the recorded pitch is based on processor speed]
    List<String> xVals = ChartData.generateXVals(0, pitchDataSet.getEntryCount());
    chartData = new CombinedData(xVals);

    pitchDataSet.setColor(getResources().getColor(R.color.canvas_dark));
    pitchDataSet.setDrawCircles(false);
    pitchDataSet.setLineWidth(2f);
    pitchDataSet.setDrawValues(false);
    pitchDataSet.setAxisDependency(YAxis.AxisDependency.LEFT);

    pitchData = new LineData(xVals, pitchDataSet);
    chartData.setData(pitchData);

    genderBarData = new BarData(xVals, GraphLayout.getOverallRange(this.getContext(), xVals.size()));
    // Bug with chart lib that throws exception for empty bar charts so must skip adding it on init
    // if were coming from the live pitch graph.
    if (!xVals.isEmpty())
        chartData.setData(genderBarData);

    chart.setData(chartData);

    chart.setDrawValueAboveBar(false);
    chart.setDrawOrder(new CombinedChart.DrawOrder[]{
            CombinedChart.DrawOrder.BAR,
            CombinedChart.DrawOrder.BUBBLE,
            CombinedChart.DrawOrder.CANDLE,
            CombinedChart.DrawOrder.LINE,
            CombinedChart.DrawOrder.SCATTER
    });

    GraphLayout.FormatChart(chart);

    super.onViewCreated(view, savedInstanceState);
}