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


Java YAxis.setSpaceTop方法代码示例

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


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

示例1: setupYAxis

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
private void setupYAxis()
{
    int valuesSelectedItemPos = cache.getValuesSpinner().getSelectedItemPosition();
    YAxis leftAxis = this.chart.getAxisLeft();
    leftAxis.setLabelCount(10, false);
    leftAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
    leftAxis.setSpaceTop(20f);
    leftAxis.setAxisMinValue(0f);
    leftAxis.setValueFormatter(new PFAYAxisLabels(context, valuesSelectedItemPos, cache.getNumberScale()));

    if ( valuesSelectedItemPos == StatisticsQuery.QUANTITY )
    {
        leftAxis.setGranularity(1f); // interval 1
    }

    YAxis rightAxis = this.chart.getAxisRight();
    rightAxis.setEnabled(false);
}
 
开发者ID:SecUSo,项目名称:privacy-friendly-shopping-list,代码行数:19,代码来源:PFAChart.java

示例2: setHorizontalBarChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
 * 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));
}
 
开发者ID:graviton57,项目名称:DOUSalaries,代码行数:46,代码来源:ChartHelper.java

示例3: setVerticalBarChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:graviton57,项目名称:DOUSalaries,代码行数:40,代码来源:ChartHelper.java

示例4: setupChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
private void setupChart() {
    mChart.setDrawBarShadow(false);
    mChart.setDrawValueAboveBar(true);
    mChart.setDescription("");
    mChart.setMaxVisibleValueCount(60);
    mChart.setPinchZoom(false);
    mChart.setDrawGridBackground(false);

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

    YAxisValueFormatter custom = new PercentFormatter();

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setLabelCount(8, false);
    leftAxis.setValueFormatter(custom);
    leftAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
    leftAxis.setSpaceTop(15f);
    leftAxis.setAxisMinValue(0f);

    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setDrawGridLines(false);
    rightAxis.setLabelCount(8, false);
    rightAxis.setValueFormatter(custom);
    rightAxis.setSpaceTop(15f);
    rightAxis.setAxisMinValue(0f);

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

    mChart.animateXY(1000, 1000);
}
 
开发者ID:andela-kogunde,项目名称:iWorkout,代码行数:39,代码来源:AnalyticsManager.java

示例5: initChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的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

示例6: initChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
private void initChart() {
    barChart.setDrawBarShadow(false);
    barChart.setDrawValueAboveBar(true);
    barChart.getDescription().setEnabled(false);
    barChart.setPinchZoom(false);
    barChart.setMaxVisibleValueCount(60);
    barChart.getLegend().setEnabled(false);
    barChart.setDrawGridBackground(false);
    barChart.getAxisRight().setEnabled(false);
    barChart.setScaleYEnabled(false);

    dayAxisValueFormatter = new DayAxisValueFormatter();
    XAxis xAxis = barChart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setLabelRotationAngle(270);
    xAxis.setDrawGridLines(false);
    xAxis.setGranularity(1f);
    xAxis.setTextColor(getOutlayTheme().secondaryTextColor);
    xAxis.setValueFormatter(dayAxisValueFormatter);


    YAxis leftAxis = barChart.getAxisLeft();
    leftAxis.setValueFormatter(new AmountValueFormatter());
    leftAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
    leftAxis.setTextColor(getOutlayTheme().secondaryTextColor);
    leftAxis.setSpaceTop(15f);
    leftAxis.setAxisMinimum(0f);
}
 
开发者ID:bmelnychuk,项目名称:outlay,代码行数:29,代码来源:AnalysisFragment.java

示例7: getView

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
@Override
        public View getView(int position, View convertView, ViewGroup parent) {

            BarData data = getItem(position);

            ViewHolder holder = null;

            if (convertView == null) {

                holder = new ViewHolder();

                convertView = LayoutInflater.from(getContext()).inflate(
                        R.layout.list_item_barchart, null);
                holder.chart = (BarChart) convertView.findViewById(R.id.chart);

                convertView.setTag(holder);

            } else {
                holder = (ViewHolder) convertView.getTag();
            }

            // apply styling
            data.setValueTypeface(mTfLight);
            data.setValueTextColor(Color.BLACK);
            holder.chart.getDescription().setEnabled(false);
            holder.chart.setDrawGridBackground(false);

            XAxis xAxis = holder.chart.getXAxis();
            xAxis.setPosition(XAxisPosition.BOTTOM);
            xAxis.setTypeface(mTfLight);
            xAxis.setDrawGridLines(false);
            
            YAxis leftAxis = holder.chart.getAxisLeft();
            leftAxis.setTypeface(mTfLight);
            leftAxis.setLabelCount(5, false);
            leftAxis.setSpaceTop(15f);
            
            YAxis rightAxis = holder.chart.getAxisRight();
            rightAxis.setTypeface(mTfLight);
            rightAxis.setLabelCount(5, false);
            rightAxis.setSpaceTop(15f);

            // set data
            holder.chart.setData(data);
            holder.chart.setFitBars(true);
            
            // do not forget to refresh the chart
//            holder.chart.invalidate();
            holder.chart.animateY(700);

            return convertView;
        }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:53,代码来源:ListViewBarChartActivity.java

示例8: onCreate

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的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);
        tvX.setTextSize(10);
        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);

//        mChart.setDrawBorders(true);

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

        mChart.setDrawBarShadow(false);

        mChart.setDrawGridBackground(false);

        // create a custom MarkerView (extend MarkerView) and specify the layout
        // to use for it
        MyMarkerView mv = new MyMarkerView(this, R.layout.custom_marker_view);
        mv.setChartView(mChart); // For bounds control
        mChart.setMarker(mv); // Set the marker to the chart

        mSeekBarX.setProgress(10);
        mSeekBarY.setProgress(100);

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

        XAxis xAxis = mChart.getXAxis();
        xAxis.setTypeface(mTfLight);
        xAxis.setGranularity(1f);
        xAxis.setCenterAxisLabels(true);
        xAxis.setValueFormatter(new IAxisValueFormatter() {
            @Override
            public String getFormattedValue(float value, AxisBase axis) {
                return String.valueOf((int) value);
            }
        });

        YAxis leftAxis = mChart.getAxisLeft();
        leftAxis.setTypeface(mTfLight);
        leftAxis.setValueFormatter(new LargeValueFormatter());
        leftAxis.setDrawGridLines(false);
        leftAxis.setSpaceTop(35f);
        leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)

        mChart.getAxisRight().setEnabled(false);
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:71,代码来源:BarChartActivityMultiDataset.java

示例9: onCreate

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

    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 = (BubbleChart) findViewById(R.id.chart1);
    mChart.getDescription().setEnabled(false);

    mChart.setOnChartValueSelectedListener(this);

    mChart.setDrawGridBackground(false);

    mChart.setTouchEnabled(true);

    // enable scaling and dragging
    mChart.setDragEnabled(true);
    mChart.setScaleEnabled(true);

    mChart.setMaxVisibleValueCount(200);
    mChart.setPinchZoom(true);

    mSeekBarX.setProgress(10);
    mSeekBarY.setProgress(50);

    Legend l = mChart.getLegend();
    l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
    l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
    l.setOrientation(Legend.LegendOrientation.VERTICAL);
    l.setDrawInside(false);
    l.setTypeface(mTfLight);

    YAxis yl = mChart.getAxisLeft();
    yl.setTypeface(mTfLight);
    yl.setSpaceTop(30f);
    yl.setSpaceBottom(30f);
    yl.setDrawZeroLine(false);
    
    mChart.getAxisRight().setEnabled(false);

    XAxis xl = mChart.getXAxis();
    xl.setPosition(XAxis.XAxisPosition.BOTTOM);
    xl.setTypeface(mTfLight);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:55,代码来源:BubbleChartActivity.java

示例10: onCreate

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的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

示例11: getView

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
@Override
    public View getView(int position, View convertView, Context c) {

        ViewHolder holder = null;

        if (convertView == null) {

            holder = new ViewHolder();

            convertView = LayoutInflater.from(c).inflate(
                    R.layout.list_item_barchart, null);
            holder.chart = (BarChart) convertView.findViewById(R.id.chart);

            convertView.setTag(holder);

        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        // apply styling
        holder.chart.getDescription().setEnabled(false);
        holder.chart.setDrawGridBackground(false);
        holder.chart.setDrawBarShadow(false);

        XAxis xAxis = holder.chart.getXAxis();
        xAxis.setPosition(XAxisPosition.BOTTOM);
        xAxis.setTypeface(mTf);
        xAxis.setDrawGridLines(false);
        xAxis.setDrawAxisLine(true);
        
        YAxis leftAxis = holder.chart.getAxisLeft();
        leftAxis.setTypeface(mTf);
        leftAxis.setLabelCount(5, false);
        leftAxis.setSpaceTop(20f);
        leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
       
        YAxis rightAxis = holder.chart.getAxisRight();
        rightAxis.setTypeface(mTf);
        rightAxis.setLabelCount(5, false);
        rightAxis.setSpaceTop(20f);
        rightAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)

        mChartData.setValueTypeface(mTf);
        
        // set data
        holder.chart.setData((BarData) mChartData);
        holder.chart.setFitBars(true);
        
        // do not forget to refresh the chart
//        holder.chart.invalidate();
        holder.chart.animateY(700);

        return convertView;
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:55,代码来源:BarChartItem.java

示例12: setGroupBarChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:graviton57,项目名称:DOUSalaries,代码行数:48,代码来源:ChartHelper.java

示例13: init

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
private void init(Context context, AttributeSet attrs, int defStyle) {
    setDrawBarShadow(false);
    setDrawValueAboveBar(true);
    getDescription().setEnabled(false);
    setMaxVisibleValueCount(60);
    setDrawGridBackground(false);

    XAxis xAxis = getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setDrawGridLines(false);
    xAxis.setGranularity(1f);
    xAxis.setLabelCount(7);
    xAxis.setTextColor(Color.GRAY);

    YAxis leftAxis = getAxisLeft();
    leftAxis.setDrawGridLines(false);
    leftAxis.setLabelCount(8, false);
    leftAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
    leftAxis.setSpaceTop(15f);
    leftAxis.setAxisMinimum(0f);
    leftAxis.setTextColor(Color.GRAY);

    YAxis rightAxis = getAxisRight();
    rightAxis.setDrawGridLines(false);
    rightAxis.setDrawAxisLine(false);
    rightAxis.setLabelCount(8, false);
    rightAxis.setDrawLabels(false);
    rightAxis.setSpaceTop(15f);
    rightAxis.setAxisMinimum(0f);

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

}
 
开发者ID:VidyaSastry,项目名称:Opal-Chat-AnalyticsDashboard,代码行数:42,代码来源:MyBarChart.java

示例14: onCreate

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的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

示例15: getView

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
@Override
        public View getView(int position, View convertView, ViewGroup parent) {

            BarData data = getItem(position);

            ViewHolder holder = null;

            if (convertView == null) {

                holder = new ViewHolder();

                convertView = LayoutInflater.from(getContext()).inflate(
                        R.layout.list_item_barchart, null);
                holder.chart = (BarChart) convertView.findViewById(R.id.chart);

                convertView.setTag(holder);

            } else {
                holder = (ViewHolder) convertView.getTag();
            }

            // apply styling
            data.setValueTypeface(mTf);
            data.setValueTextColor(Color.BLACK);
            holder.chart.setDescription("");
            holder.chart.setDrawGridBackground(false);

            XAxis xAxis = holder.chart.getXAxis();
            xAxis.setPosition(XAxisPosition.BOTTOM);
            xAxis.setTypeface(mTf);
            xAxis.setDrawGridLines(false);
            
            YAxis leftAxis = holder.chart.getAxisLeft();
            leftAxis.setTypeface(mTf);
            leftAxis.setLabelCount(5, false);
            leftAxis.setSpaceTop(15f);
            
            YAxis rightAxis = holder.chart.getAxisRight();
            rightAxis.setTypeface(mTf);
            rightAxis.setLabelCount(5, false);
            rightAxis.setSpaceTop(15f);

            // set data
            holder.chart.setData(data);
            
            // do not forget to refresh the chart
//            holder.chart.invalidate();
            holder.chart.animateY(700, Easing.EasingOption.EaseInCubic);

            return convertView;
        }
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:52,代码来源:ListViewBarChartActivity.java


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