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


Java BarChart.setDrawValueAboveBar方法代码示例

本文整理汇总了Java中com.github.mikephil.charting.charts.BarChart.setDrawValueAboveBar方法的典型用法代码示例。如果您正苦于以下问题:Java BarChart.setDrawValueAboveBar方法的具体用法?Java BarChart.setDrawValueAboveBar怎么用?Java BarChart.setDrawValueAboveBar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.github.mikephil.charting.charts.BarChart的用法示例。


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

示例1: initChart

import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
/**
 * initiliaze chart
 */
private void initChart() {
    mChart = (BarChart) findViewById(R.id.chart1);
    mChart.setDrawBarShadow(false);
    mChart.setDrawValueAboveBar(true);
    mChart.setDescription("");
    // if more than 60 entries are displayed in the chart, no values will be
    // drawn
    mChart.setMaxVisibleValueCount(60);
    // scaling can now only be done on x- and y-axis separately
    mChart.setPinchZoom(false);
    mChart.setDrawGridBackground(false);
    mChart.setDescriptionColor(Color.parseColor("#000000"));

    XAxis xAxis = mChart.getXAxis();
    xAxis.setDrawGridLines(false);
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setSpaceBetweenLabels(0);

    YAxisValueFormatter custom = new DataAxisFormatter("%");

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setValueFormatter(custom);
    leftAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);

    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setValueFormatter(custom);
    rightAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);

    leftAxis.setDrawGridLines(true);
    rightAxis.setDrawGridLines(false);

    mChart.animateY(1000);

    mChart.getLegend().setEnabled(true);

    mChart.setVisibility(View.GONE);
}
 
开发者ID:bertrandmartel,项目名称:bluetooth-le-analyzer,代码行数:41,代码来源:AnalyzerActivity.java

示例2: createBarChart

import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
public static void createBarChart(BarChart barChart, List<Pair<String, Integer>> chartData, String title, Context context){

        barChart.setDrawBarShadow(false);
        barChart.setDrawValueAboveBar(true);
        barChart.setPinchZoom(false);
        barChart.setDrawGridBackground(true);
        barChart.setScaleEnabled(false);
        barChart.getAxisRight().setEnabled(false);

        YAxis yl = barChart.getAxisLeft();
        yl.setDrawAxisLine(true);
        yl.setDrawGridLines(false);
        yl.setGridLineWidth(0.3f);

        createChart(barChart,chartData,title,context);
    }
 
开发者ID:fga-gpp-mds,项目名称:2016.2-CidadeDemocratica,代码行数:17,代码来源:CharterGenerator.java

示例3: initChart

import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
private void initChart(BarChart chart) {
    float scaledDensity = getResources().getDisplayMetrics().scaledDensity;
    chart.setDragEnabled(true);
    chart.setScaleYEnabled(false);
    chart.setScaleXEnabled(false);
    chart.setDoubleTapToZoomEnabled(false);
    chart.setPinchZoom(false);
    chart.setHighlightPerDragEnabled(false);
    chart.setHighlightPerTapEnabled(false);

    chart.setDrawGridBackground(false);
    chart.setDrawBorders(false);
    chart.setDrawValueAboveBar(false);
    chart.getAxisLeft().setEnabled(false);
    XAxis xAxis = chart.getXAxis();
    xAxis.setDrawAxisLine(true);
    xAxis.setDrawGridLines(false);
    xAxis.setDrawLabels(false);
    xAxis.setDrawLimitLinesBehindData(false);
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);

    YAxis yAxis = chart.getAxisRight();
    yAxis.setDrawAxisLine(false);
    yAxis.setStartAtZero(false);
    yAxis.setSpaceTop(10f);
    yAxis.setSpaceBottom(0f);
    yAxis.setTextSize(10 * scaledDensity);
    yAxis.setTextColor(ContextCompat.getColor(this, R.color.text));
    chart.getLegend().setEnabled(false);
    chart.setDescription(" ");

    chart.setNoDataText("Can't see sh*t captain!");
    Paint p = chart.getPaint(Chart.PAINT_INFO);
    DisplayMetrics dm = getResources().getDisplayMetrics();
    int size = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 18, dm); //TODO use styles
    p.setTextSize(size);
    p.setColor(ContextCompat.getColor(this, R.color.gray600));
    p.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
}
 
开发者ID:stanleyguevara,项目名称:beaconradar,代码行数:40,代码来源:DetailsActivity.java

示例4: buildChart

import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
protected Chart buildChart(Context context) {
    BarChart chart = new BarChart(context);
    chart.setDrawBarShadow(true);
    chart.setDrawValueAboveBar(true);
    chart.setMaxVisibleValueCount(60);
    chart.setPinchZoom(true);
    return chart;
}
 
开发者ID:Tiraza,项目名称:easy-finance,代码行数:9,代码来源:ChartExpensesByType.java

示例5: buildView

import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
@Override
public View buildView(Context context, ViewGroup viewGroup, FragmentManager fragmentManager) {
    BarChart chart = new BarChart(context);
    chart.setDrawBarShadow(true);
    chart.setDrawValueAboveBar(true);
    chart.setMaxVisibleValueCount(60);
    chart.setPinchZoom(true);
    return chart;
}
 
开发者ID:Tiraza,项目名称:easy-finance,代码行数:10,代码来源:ChartIncomesByType.java

示例6: initChart

import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
private void initChart() {
    barChart = (BarChart)findViewById(R.id.chart);
    barChart.setBorderColor(getResources().getColor(R.color.primary_dark));
    barChart.setDrawBarShadow(false);
    barChart.setDrawValueAboveBar(true);
    barChart.setDescription("Operations/second");
    barChart.setMaxVisibleValueCount(20);
    barChart.setPinchZoom(false);
    barChart.setDrawGridBackground(false);

    XAxis xl = barChart.getXAxis();
    xl.setPosition(XAxis.XAxisPosition.BOTTOM);
    xl.setDrawAxisLine(true);
    xl.setDrawGridLines(true);
    xl.setGridLineWidth(0.3f);

    YAxis yl = barChart.getAxisLeft();
    yl.setDrawAxisLine(true);
    yl.setDrawGridLines(true);
    yl.setGridLineWidth(0.3f);

    YAxis yr = barChart.getAxisRight();
    yr.setDrawAxisLine(true);
    yr.setDrawGridLines(false);

    Legend l = barChart.getLegend();
    l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);
    l.setFormSize(8f);
    l.setXEntrySpace(4f);
}
 
开发者ID:koustuvsinha,项目名称:benchmarker,代码行数:31,代码来源:DbGraphActivity.java

示例7: onCreate

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

    tvX = (TextView) findViewById(R.id.tvXMax);
    tvY = (TextView) findViewById(R.id.tvYMax);

    mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
    mSeekBarX.setOnSeekBarChangeListener(this);

    mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
    mSeekBarY.setOnSeekBarChangeListener(this);

    mChart = (BarChart) findViewById(R.id.chart1);
    mChart.setOnChartValueSelectedListener(this);

    mChart.getDescription().setEnabled(false);

    // if more than 60 entries are displayed in the chart, no values will be
    // drawn
    mChart.setMaxVisibleValueCount(40);

    // scaling can now only be done on x- and y-axis separately
    mChart.setPinchZoom(false);

    mChart.setDrawGridBackground(false);
    mChart.setDrawBarShadow(false);

    mChart.setDrawValueAboveBar(false);
    mChart.setHighlightFullBarEnabled(false);

    // change the position of the y-labels
    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setValueFormatter(new MyAxisValueFormatter());
    leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
    mChart.getAxisRight().setEnabled(false);

    XAxis xLabels = mChart.getXAxis();
    xLabels.setPosition(XAxisPosition.TOP);

    // mChart.setDrawXLabels(false);
    // mChart.setDrawYLabels(false);

    // setting data
    mSeekBarX.setProgress(12);
    mSeekBarY.setProgress(100);

    Legend l = mChart.getLegend();
    l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
    l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
    l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
    l.setDrawInside(false);
    l.setFormSize(8f);
    l.setFormToTextSpace(4f);
    l.setXEntrySpace(6f);

    // mChart.setDrawLegend(false);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:61,代码来源:StackedBarActivity.java

示例8: onCreate

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

    mSinusData = FileUtils.loadBarEntriesFromAssets(getAssets(), "othersine.txt");

    tvX = (TextView) findViewById(R.id.tvValueCount);

    mSeekBarX = (SeekBar) findViewById(R.id.seekbarValues);

    mChart = (BarChart) findViewById(R.id.chart1);

    mChart.setDrawBarShadow(false);
    mChart.setDrawValueAboveBar(true);

    mChart.getDescription().setEnabled(false);

    // if more than 60 entries are displayed in the chart, no values will be
    // drawn
    mChart.setMaxVisibleValueCount(60);

    // scaling can now only be done on x- and y-axis separately
    mChart.setPinchZoom(false);

    // draw shadows for each bar that show the maximum value
    // mChart.setDrawBarShadow(true);

    // mChart.setDrawXLabels(false);

    mChart.setDrawGridBackground(false);
    // mChart.setDrawYLabels(false);

    XAxis xAxis = mChart.getXAxis();
    xAxis.setEnabled(false);

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTypeface(mTfLight);
    leftAxis.setLabelCount(6, false);
    leftAxis.setAxisMinimum(-2.5f);
    leftAxis.setAxisMaximum(2.5f);
    leftAxis.setGranularityEnabled(true);
    leftAxis.setGranularity(0.1f);

    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setDrawGridLines(false);
    rightAxis.setTypeface(mTfLight);
    rightAxis.setLabelCount(6, false);
    rightAxis.setAxisMinimum(-2.5f);
    rightAxis.setAxisMaximum(2.5f);
    rightAxis.setGranularity(0.1f);

    mSeekBarX.setOnSeekBarChangeListener(this);
    mSeekBarX.setProgress(150); // set data

    Legend l = mChart.getLegend();
    l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
    l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.LEFT);
    l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
    l.setDrawInside(false);
    l.setForm(LegendForm.SQUARE);
    l.setFormSize(9f);
    l.setTextSize(11f);
    l.setXEntrySpace(4f);

    mChart.animateXY(2000, 2000);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:70,代码来源:BarChartActivitySinus.java

示例9: onCreate

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

    mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
    mChart = (BarChart) findViewById(R.id.chart1);
    mChart.setBackgroundColor(Color.WHITE);
    mChart.setExtraTopOffset(-30f);
    mChart.setExtraBottomOffset(10f);
    mChart.setExtraLeftOffset(70f);
    mChart.setExtraRightOffset(70f);

    mChart.setDrawBarShadow(false);
    mChart.setDrawValueAboveBar(true);

    mChart.getDescription().setEnabled(false);

    // scaling can now only be done on x- and y-axis separately
    mChart.setPinchZoom(false);

    mChart.setDrawGridBackground(false);

    XAxis xAxis = mChart.getXAxis();
    xAxis.setPosition(XAxisPosition.BOTTOM);
    xAxis.setTypeface(mTf);
    xAxis.setDrawGridLines(false);
    xAxis.setDrawAxisLine(false);
    xAxis.setTextColor(Color.LTGRAY);
    xAxis.setTextSize(13f);
    xAxis.setLabelCount(5);
    xAxis.setCenterAxisLabels(true);
    xAxis.setGranularity(1f);

    YAxis left = mChart.getAxisLeft();
    left.setDrawLabels(false);
    left.setSpaceTop(25f);
    left.setSpaceBottom(25f);
    left.setDrawAxisLine(false);
    left.setDrawGridLines(false);
    left.setDrawZeroLine(true); // draw a zero line
    left.setZeroLineColor(Color.GRAY);
    left.setZeroLineWidth(0.7f);
    mChart.getAxisRight().setEnabled(false);
    mChart.getLegend().setEnabled(false);

    // THIS IS THE ORIGINAL DATA YOU WANT TO PLOT
    final List<Data> data = new ArrayList<>();
    data.add(new Data(0f, -224.1f, "12-29"));
    data.add(new Data(1f, 238.5f, "12-30"));
    data.add(new Data(2f, 1280.1f, "12-31"));
    data.add(new Data(3f, -442.3f, "01-01"));
    data.add(new Data(4f, -2280.1f, "01-02"));

    xAxis.setValueFormatter(new IAxisValueFormatter() {
        @Override
        public String getFormattedValue(float value, AxisBase axis) {
            return data.get(Math.min(Math.max((int) value, 0), data.size()-1)).xAxisValue;
        }
    });

    setData(data);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:66,代码来源:BarChartPositiveNegative.java

示例10: initCharts

import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
private void initCharts(BarChart mChart) {
        mChart.setDrawBarShadow(false);
        mChart.setDrawValueAboveBar(true);

        mChart.setDescription("");

        // if more than 60 entries are displayed in the chart, no values will be
        // drawn
        mChart.setMaxVisibleValueCount(60);

        // scaling can now only be done on x- and y-axis separately
        mChart.setPinchZoom(false);

        // draw shadows for each bar that show the maximum value
        // mChart.setDrawBarShadow(true);

        // mChart.setDrawXLabels(false);

        mChart.setDrawGridBackground(false);
        // mChart.setDrawYLabels(false);

        XAxis xAxis = mChart.getXAxis();
        xAxis.setEnabled(false);

        YAxis leftAxis = mChart.getAxisLeft();
        leftAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
        leftAxis.setLabelCount(6, false);
//        leftAxis.setAxisMinimum(-2.5f);
//        leftAxis.setAxisMaximum(2.5f);
        leftAxis.setGranularityEnabled(true);
        leftAxis.setGranularity(0.1f);

        YAxis rightAxis = mChart.getAxisRight();
        rightAxis.setDrawGridLines(false);
        rightAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
        rightAxis.setLabelCount(6, false);
//        rightAxis.setAxisMinimum(-2.5f);
//        rightAxis.setAxisMaximum(2.5f);
        rightAxis.setGranularity(0.1f);

        Legend l = mChart.getLegend();
        l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);
        l.setForm(Legend.LegendForm.SQUARE);
        l.setFormSize(9f);
        l.setTextSize(11f);
        l.setXEntrySpace(4f);

        mChart.animateXY(2000, 2000);
    }
 
开发者ID:qizhenghao,项目名称:Microsoft_Band,代码行数:50,代码来源:AccelerateFragment.java

示例11: onCreate

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

	tvX = (TextView) findViewById(R.id.tvXMax);
	tvY = (TextView) findViewById(R.id.tvYMax);

	mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
	mSeekBarX.setOnSeekBarChangeListener(this);

	mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
	mSeekBarY.setOnSeekBarChangeListener(this);

	mChart = (BarChart) findViewById(R.id.chart1);
	mChart.setOnChartValueSelectedListener(this);

	mChart.setDescription("");

	// if more than 60 entries are displayed in the chart, no values will be
	// drawn
	mChart.setMaxVisibleValueCount(60);

	// scaling can now only be done on x- and y-axis separately
	mChart.setPinchZoom(false);

	mChart.setDrawGridBackground(false);
	mChart.setDrawBarShadow(false);

	mChart.setDrawValueAboveBar(false);

	// change the position of the y-labels
	YAxis leftAxis = mChart.getAxisLeft();
	leftAxis.setValueFormatter(new MyYAxisValueFormatter());
	leftAxis.setAxisMinValue(0f); // this replaces setStartAtZero(true)
	mChart.getAxisRight().setEnabled(false);

	XAxis xLabels = mChart.getXAxis();
	xLabels.setPosition(XAxisPosition.TOP);

	// mChart.setDrawXLabels(false);
	// mChart.setDrawYLabels(false);

	// setting data
	mSeekBarX.setProgress(12);
	mSeekBarY.setProgress(100);

	Legend l = mChart.getLegend();
	l.setPosition(LegendPosition.BELOW_CHART_RIGHT);
	l.setFormSize(8f);
	l.setFormToTextSpace(4f);
	l.setXEntrySpace(6f);

	// mChart.setDrawLegend(false);
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:57,代码来源:StackedBarActivity.java

示例12: onCreate

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

    tvX = (TextView) findViewById(R.id.tvXMax);
    tvY = (TextView) findViewById(R.id.tvYMax);

    mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
    mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);

    mChart = (BarChart) findViewById(R.id.chart1);
    mChart.setOnChartValueSelectedListener(this);

    mChart.setDrawBarShadow(false);
    mChart.setDrawValueAboveBar(true);

    mChart.setDescription("");

    // if more than 60 entries are displayed in the chart, no values will be
    // drawn
    mChart.setMaxVisibleValueCount(60);

    // scaling can now only be done on x- and y-axis separately
    mChart.setPinchZoom(false);

    mChart.setDrawGridBackground(false);
    // mChart.setDrawYLabels(false);

    mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");

    XAxis xAxis = mChart.getXAxis();
    xAxis.setPosition(XAxisPosition.BOTTOM);
    xAxis.setTypeface(mTf);
    xAxis.setDrawGridLines(false);
    xAxis.setSpaceBetweenLabels(2);

    YAxisValueFormatter custom = new MyYAxisValueFormatter();

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTypeface(mTf);
    leftAxis.setLabelCount(8, false);
    leftAxis.setValueFormatter(custom);
    leftAxis.setPosition(YAxisLabelPosition.OUTSIDE_CHART);
    leftAxis.setSpaceTop(15f);
    leftAxis.setAxisMinValue(0f); // this replaces setStartAtZero(true)

    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setDrawGridLines(false);
    rightAxis.setTypeface(mTf);
    rightAxis.setLabelCount(8, false);
    rightAxis.setValueFormatter(custom);
    rightAxis.setSpaceTop(15f);
    rightAxis.setAxisMinValue(0f); // this replaces setStartAtZero(true)

    Legend l = mChart.getLegend();
    l.setPosition(LegendPosition.BELOW_CHART_LEFT);
    l.setForm(LegendForm.SQUARE);
    l.setFormSize(9f);
    l.setTextSize(11f);
    l.setXEntrySpace(4f);
    // l.setExtra(ColorTemplate.VORDIPLOM_COLORS, new String[] { "abc",
    // "def", "ghj", "ikl", "mno" });
    // l.setCustom(ColorTemplate.VORDIPLOM_COLORS, new String[] { "abc",
    // "def", "ghj", "ikl", "mno" });

    setData(12, 50);

    // setting data
    mSeekBarY.setProgress(50);
    mSeekBarX.setProgress(12);

    mSeekBarY.setOnSeekBarChangeListener(this);
    mSeekBarX.setOnSeekBarChangeListener(this);

    // mChart.setDrawLegend(false);
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:80,代码来源:BarChartActivity.java

示例13: onCreate

import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_barchart_sinus);
    
    mSinusData = FileUtils.loadBarEntriesFromAssets(getAssets(),"othersine.txt");

    tvX = (TextView) findViewById(R.id.tvValueCount);

    mSeekBarX = (SeekBar) findViewById(R.id.seekbarValues);

    mChart = (BarChart) findViewById(R.id.chart1);

    mChart.setDrawBarShadow(false);
    mChart.setDrawValueAboveBar(true);

    mChart.setDescription("");

    // if more than 60 entries are displayed in the chart, no values will be
    // drawn
    mChart.setMaxVisibleValueCount(60);

    // scaling can now only be done on x- and y-axis separately
    mChart.setPinchZoom(false);

    // draw shadows for each bar that show the maximum value
    // mChart.setDrawBarShadow(true);

    // mChart.setDrawXLabels(false);

    mChart.setDrawGridBackground(false);
    // mChart.setDrawYLabels(false);

    mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");

    XAxis xAxis = mChart.getXAxis();
    xAxis.setPosition(XAxisPosition.BOTTOM);
    xAxis.setTypeface(mTf);
    xAxis.setDrawGridLines(false);
    xAxis.setEnabled(false);

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTypeface(mTf);
    leftAxis.setLabelCount(6, false);
    leftAxis.setAxisMinValue(-2.5f);
    leftAxis.setAxisMaxValue(2.5f);

    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setDrawGridLines(false);
    rightAxis.setTypeface(mTf);
    rightAxis.setLabelCount(6, false);
    rightAxis.setAxisMinValue(-2.5f);
    rightAxis.setAxisMaxValue(2.5f);

    mSeekBarX.setOnSeekBarChangeListener(this);
    mSeekBarX.setProgress(150); // set data

    Legend l = mChart.getLegend();
    l.setPosition(LegendPosition.BELOW_CHART_LEFT);
    l.setForm(LegendForm.SQUARE);
    l.setFormSize(9f);
    l.setTextSize(11f);
    l.setXEntrySpace(4f);

    mChart.animateXY(2000, 2000);
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:69,代码来源:BarChartActivitySinus.java

示例14: onCreate

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

    mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
    mChart = (BarChart) findViewById(R.id.chart1);
    mChart.setBackgroundColor(Color.WHITE);
    mChart.setExtraTopOffset(-30f);
    mChart.setExtraBottomOffset(10f);
    mChart.setExtraLeftOffset(70f);
    mChart.setExtraRightOffset(70f);

    mChart.setDrawBarShadow(false);
    mChart.setDrawValueAboveBar(true);

    mChart.setDescription("");

    // scaling can now only be done on x- and y-axis separately
    mChart.setPinchZoom(false);

    mChart.setDrawGridBackground(false);

    XAxis xAxis = mChart.getXAxis();
    xAxis.setPosition(XAxisPosition.BOTTOM);
    xAxis.setTypeface(mTf);
    xAxis.setDrawGridLines(false);
    xAxis.setDrawAxisLine(false);
    xAxis.setSpaceBetweenLabels(2);
    xAxis.setTextColor(Color.LTGRAY);
    xAxis.setTextSize(13f);

    YAxis left = mChart.getAxisLeft();
    left.setDrawLabels(false);
    left.setStartAtZero(false);
    left.setSpaceTop(25f);
    left.setSpaceBottom(25f);
    left.setDrawAxisLine(false);
    left.setDrawGridLines(false);
    left.setDrawZeroLine(true); // draw a zero line
    left.setZeroLineColor(Color.GRAY);
    left.setZeroLineWidth(0.7f);
    mChart.getAxisRight().setEnabled(false);
    mChart.getLegend().setEnabled(false);

    // THIS IS THE ORIGINAL DATA YOU WANT TO PLOT
    List<Data> data = new ArrayList<>();
    data.add(new Data(0, -224.1f, "12-29"));
    data.add(new Data(1, 238.5f, "12-30"));
    data.add(new Data(2, 1280.1f, "12-31"));
    data.add(new Data(3, -442.3f, "01-01"));
    data.add(new Data(4, -2280.1f, "01-02"));

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

示例15: setDrawValueAboveBar

import com.github.mikephil.charting.charts.BarChart; //导入方法依赖的package包/类
@ReactProp(name = "drawValueAboveBar")
public void setDrawValueAboveBar(BarChart chart, boolean enabled) {
    chart.setDrawValueAboveBar(enabled);
}
 
开发者ID:mskec,项目名称:react-native-mp-android-chart,代码行数:5,代码来源:BarChartManager.java


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