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


Java YAxis.setTypeface方法代码示例

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


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

示例1: setup

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
 * 设置字体
 *
 * @param chart
 */
protected void setup(Chart<?> chart) {
    mTy = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
    chart.setDescription("");
    chart.setNoDataTextDescription("You need to provide data for the chart.");
    chart.setTouchEnabled(true);
    if (chart instanceof BarLineChartBase) {
        BarLineChartBase mChart = (BarLineChartBase) chart;
        mChart.setDrawGridBackground(false);
        mChart.setDragEnabled(true);
        mChart.setScaleEnabled(true);
        mChart.setPinchZoom(false);
        YAxis leftAxis = mChart.getAxisLeft();
        leftAxis.removeAllLimitLines(); // reset all limit lines to avoid overlapping lines
        leftAxis.setTypeface(mTy);
        leftAxis.setTextSize(8f);
        leftAxis.setTextColor(Color.WHITE);
        XAxis xAxis = mChart.getXAxis();
        xAxis.setLabelRotationAngle(-50);//设置x轴字体显示角度
        xAxis.setTypeface(mTy);
        xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
        xAxis.setTextSize(8f);
        xAxis.setTextColor(Color.WHITE);
        mChart.getAxisRight().setEnabled(false);
    }
}
 
开发者ID:dscn,项目名称:ktball,代码行数:31,代码来源:SchoolAllPeopleDetailAcitivty.java

示例2: onCreateView

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.frag_simple_bar, container, false);
    
    // create a new chart object
    mChart = new BarChart(getActivity());
    mChart.getDescription().setEnabled(false);
    mChart.setOnChartGestureListener(this);
    
    MyMarkerView mv = new MyMarkerView(getActivity(), R.layout.custom_marker_view);
    mv.setChartView(mChart); // For bounds control
    mChart.setMarker(mv);

    mChart.setDrawGridBackground(false);
    mChart.setDrawBarShadow(false);
    
    Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),"OpenSans-Light.ttf");
    
    mChart.setData(generateBarData(1, 20000, 12));
    
    Legend l = mChart.getLegend();
    l.setTypeface(tf);
    
    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTypeface(tf);
    leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)

    mChart.getAxisRight().setEnabled(false);
    
    XAxis xAxis = mChart.getXAxis();
    xAxis.setEnabled(false);
    
    // programatically add the chart
    FrameLayout parent = (FrameLayout) v.findViewById(R.id.parentLayout);
    parent.addView(mChart);
    
    return v;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:39,代码来源:BarChartFrag.java

示例3: onCreateView

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.frag_simple_scatter, container, false);
    
    mChart = (ScatterChart) v.findViewById(R.id.scatterChart1);
    mChart.getDescription().setEnabled(false);
    
    Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),"OpenSans-Light.ttf");
    
    MyMarkerView mv = new MyMarkerView(getActivity(), R.layout.custom_marker_view);
    mv.setChartView(mChart); // For bounds control
    mChart.setMarker(mv);

    mChart.setDrawGridBackground(false);
    mChart.setData(generateScatterData(6, 10000, 200));
    
    XAxis xAxis = mChart.getXAxis();
    xAxis.setEnabled(true);
    xAxis.setPosition(XAxisPosition.BOTTOM);
    
    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTypeface(tf);
    
    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setTypeface(tf);
    rightAxis.setDrawGridLines(false);
    
    Legend l = mChart.getLegend();
    l.setWordWrapEnabled(true);
    l.setTypeface(tf);
    l.setFormSize(14f);
    l.setTextSize(9f);
    
    // increase the space between legend & bottom and legend & content
    l.setYOffset(13f);       
    mChart.setExtraBottomOffset(16f);
    
    return v;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:40,代码来源:ScatterChartFrag.java

示例4: 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_draw_chart);

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

    // listener for selecting and drawing
    mChart.setOnChartValueSelectedListener(this);
    mChart.setOnDrawListener(this);

    // if disabled, drawn datasets with the finger will not be automatically
    // finished
    // mChart.setAutoFinish(true);
    mChart.setDrawGridBackground(false);

    // add dummy-data to the chart
    initWithDummyData();

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

    XAxis xl = mChart.getXAxis();
    xl.setTypeface(tf);
    xl.setAvoidFirstLastClipping(true);

    YAxis yl = mChart.getAxisLeft();
    yl.setTypeface(tf);

    mChart.getLegend().setEnabled(false);

    // mChart.setYRange(-40f, 40f, true);
    // call this to reset the changed y-range
    // mChart.resetYRange(true);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:37,代码来源:DrawChartActivity.java

示例5: 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

示例6: setup

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
protected void setup(Chart<?> chart) {

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

        // no description text
        chart.getDescription().setEnabled(false);

        // enable touch gestures
        chart.setTouchEnabled(true);

        if (chart instanceof BarLineChartBase) {

            BarLineChartBase mChart = (BarLineChartBase) chart;

            mChart.setDrawGridBackground(false);

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

            // if disabled, scaling can be done on x- and y-axis separately
            mChart.setPinchZoom(false);

            YAxis leftAxis = mChart.getAxisLeft();
            leftAxis.removeAllLimitLines(); // reset all limit lines to avoid overlapping lines
            leftAxis.setTypeface(mTf);
            leftAxis.setTextSize(8f);
            leftAxis.setTextColor(Color.DKGRAY);
            leftAxis.setValueFormatter(new PercentFormatter());

            XAxis xAxis = mChart.getXAxis();
            xAxis.setTypeface(mTf);
            xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
            xAxis.setTextSize(8f);
            xAxis.setTextColor(Color.DKGRAY);

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

示例7: 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

示例8: setLineChart

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

}
 
开发者ID:graviton57,项目名称:DOUSalaries,代码行数:45,代码来源:ChartHelper.java

示例9: initTemperatureChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
private void initTemperatureChart(LineChart mChart) {
//        mChart.setOnChartValueSelectedListener(this);
        mChart.setDescription("Skin Temperature");
        mChart.setNoDataTextDescription("You need to provide data for the chart.");
        mChart.setTouchEnabled(true);
        mChart.setDragDecelerationFrictionCoef(0.9f);
        mChart.setDragEnabled(true);
        mChart.setScaleEnabled(true);
        mChart.setDrawGridBackground(false);
        mChart.setHighlightPerDragEnabled(true);
        mChart.setPinchZoom(true);
        mChart.setBackgroundColor(getResources().getColor(R.color.blue_light_pressed));
        mChart.animateX(2500);

        Legend l = mChart.getLegend();
        l.setForm(Legend.LegendForm.LINE);
        l.setTypeface(BandApplication.INSTANCE.getTfLight());
        l.setTextSize(11f);
        l.setTextColor(Color.WHITE);
        l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);

        mChart.getXAxis().setEnabled(false);

        YAxis leftAxis = mChart.getAxisLeft();
        leftAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
        leftAxis.setTextColor(Color.RED);
        leftAxis.setDrawGridLines(true);
        leftAxis.setGranularityEnabled(true);

        YAxis rightAxis = mChart.getAxisRight();
        rightAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
        rightAxis.setTextColor(Color.RED);
        rightAxis.setDrawGridLines(false);
        rightAxis.setDrawZeroLine(false);
        rightAxis.setGranularityEnabled(false);
    }
 
开发者ID:qizhenghao,项目名称:Microsoft_Band,代码行数:37,代码来源:HeartRateFragment.java

示例10: initResistanceChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
private void initResistanceChart(LineChart mChart) {
    //        mChart.setOnChartValueSelectedListener(this);
    mChart.setDescription("Skin Resistance");
    mChart.setNoDataTextDescription("You need to provide data for the chart.");
    mChart.setTouchEnabled(true);
    mChart.setDragDecelerationFrictionCoef(0.9f);
    mChart.setDragEnabled(true);
    mChart.setScaleEnabled(true);
    mChart.setDrawGridBackground(false);
    mChart.setHighlightPerDragEnabled(true);
    mChart.setPinchZoom(true);
    mChart.setBackgroundColor(getResources().getColor(R.color.green_pressed));
    mChart.animateX(2500);

    Legend l = mChart.getLegend();
    l.setForm(Legend.LegendForm.LINE);
    l.setTypeface(BandApplication.INSTANCE.getTfLight());
    l.setTextSize(11f);
    l.setTextColor(Color.WHITE);
    l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);

    mChart.getXAxis().setEnabled(false);

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
    leftAxis.setTextColor(Color.RED);
    leftAxis.setDrawGridLines(true);
    leftAxis.setGranularityEnabled(true);

    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
    rightAxis.setTextColor(Color.RED);
    rightAxis.setDrawGridLines(false);
    rightAxis.setDrawZeroLine(false);
    rightAxis.setGranularityEnabled(false);
}
 
开发者ID:qizhenghao,项目名称:Microsoft_Band,代码行数:37,代码来源:HeartRateFragment.java

示例11: onCreateView

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.frag_simple_scatter, container, false);
    
    mChart = (ScatterChart) v.findViewById(R.id.scatterChart1);
    mChart.setDescription("");
    
    Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),"OpenSans-Light.ttf");
    
    MyMarkerView mv = new MyMarkerView(getActivity(), R.layout.custom_marker_view);

    mChart.setMarkerView(mv);

    mChart.setDrawGridBackground(false);
    mChart.setData(generateScatterData(6, 10000, 200));
    
    XAxis xAxis = mChart.getXAxis();
    xAxis.setEnabled(true);
    xAxis.setPosition(XAxisPosition.BOTTOM);
    
    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTypeface(tf);
    
    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setTypeface(tf);
    rightAxis.setDrawGridLines(false);
    
    Legend l = mChart.getLegend();
    l.setWordWrapEnabled(true);
    l.setTypeface(tf);
    l.setFormSize(14f);
    l.setTextSize(9f);
    
    // increase the space between legend & bottom and legend & content
    l.setYOffset(13f);       
    mChart.setExtraBottomOffset(16f);
    
    return v;
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:40,代码来源:ScatterChartFrag.java

示例12: 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

示例13: 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_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

示例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);
        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

示例15: 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_scatterchart);

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

    mChart.setDrawGridBackground(false);
    mChart.setTouchEnabled(true);
    mChart.setMaxHighlightDistance(50f);

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

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

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

    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);
    l.setXOffset(5f);

    YAxis yl = mChart.getAxisLeft();
    yl.setTypeface(mTfLight);
    yl.setAxisMinimum(0f); // this replaces setStartAtZero(true)
    
    mChart.getAxisRight().setEnabled(false);

    XAxis xl = mChart.getXAxis();
    xl.setTypeface(mTfLight);
    xl.setDrawGridLines(false);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:53,代码来源:ScatterChartActivity.java


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