當前位置: 首頁>>代碼示例>>Java>>正文


Java Legend.setTextSize方法代碼示例

本文整理匯總了Java中com.github.mikephil.charting.components.Legend.setTextSize方法的典型用法代碼示例。如果您正苦於以下問題:Java Legend.setTextSize方法的具體用法?Java Legend.setTextSize怎麽用?Java Legend.setTextSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.github.mikephil.charting.components.Legend的用法示例。


在下文中一共展示了Legend.setTextSize方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initTemperatureChart

import com.github.mikephil.charting.components.Legend; //導入方法依賴的package包/類
private void initTemperatureChart() {
    m_barChart.setDrawBarShadow(false);
    m_barChart.setDrawValueAboveBar(true);

    m_barChart.setDescription("");
    m_barChart.setDrawBarShadow(false);

    m_barChart.setDrawGridBackground(false);
    m_barChart.setTouchEnabled(false);
    m_barChart.setScaleXEnabled(false);
    m_barChart.setScaleYEnabled(false);

    XAxis xAxis = m_barChart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setDrawGridLines(false);
    xAxis.setSpaceBetweenLabels(1);

    Legend l = m_barChart.getLegend();
    l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);
    l.setForm(Legend.LegendForm.SQUARE);
    l.setFormSize(9f);
    l.setTextSize(11f);
    l.setXEntrySpace(4f);
}
 
開發者ID:ChanJLee,項目名稱:YunShuWeather,代碼行數:25,代碼來源:WeatherForecastActivity.java

示例2: onCreateView

import com.github.mikephil.charting.components.Legend; //導入方法依賴的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

示例3: setLineChart

import com.github.mikephil.charting.components.Legend; //導入方法依賴的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

示例4: onCreateView

import com.github.mikephil.charting.components.Legend; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_idpt, container, false);

    BarChart chart = (BarChart) view.findViewById(R.id.chart);

    BarData data = new BarData(getXAxisValues(), getDataSet());

    //legend coding
    Legend l=chart.getLegend();
    l.setFormSize(10f);
    l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);
    l.setTextSize(12f);
    l.setTextColor(Color.BLACK);
    l.setXEntrySpace(5f);
    l.setYEntrySpace(5f);
    //l.setCustom();

    XAxis xaxis=chart.getXAxis();
    xaxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xaxis.setTextSize(7f);
    xaxis.setTextColor(Color.parseColor("#212121"));
    xaxis.setDrawAxisLine(true);
    xaxis.setDrawGridLines(false);


    chart.setData(data);
    chart.setDescription("");
    chart.animateXY(2000, 2000);
    chart.invalidate();
   // chart.zoom(100, 10, 10, 10);


    return view;


}
 
開發者ID:Ronak-59,項目名稱:Trinity-App,代碼行數:38,代碼來源:IDPTFragment.java

示例5: initLineChart

import com.github.mikephil.charting.components.Legend; //導入方法依賴的package包/類
/**
 * 初始化LineChart
 */
private void initLineChart() {
    //設置支持觸控
    mBarChart.setTouchEnabled(true); // 設置是否可以觸摸
    mBarChart.setDragEnabled(false);// 是否可以拖拽
    mBarChart.setScaleEnabled(false);// 是否可以縮放
    mBarChart.setBackgroundColor(Color.WHITE);//背景顏色
    mBarChart.setDrawGridBackground(false);  //網格
    mBarChart.setDrawBarShadow(false);//背景陰影
    mBarChart.setHighlightFullBarEnabled(false);//設置高光
    mBarChart.setDrawBorders(false);//顯示邊界
    mBarChart.getXAxis().setDrawGridLines(false);//是否顯示豎直標尺線
    mBarChart.getAxisLeft().setDrawGridLines(false);//是否顯示橫直標尺線
    mBarChart.getAxisRight().setEnabled(false);//是否顯示最右側豎線
    mBarChart.setDescription(null);

    //設置動畫效果
    mBarChart.animateY(1000, Easing.EasingOption.Linear);
    mBarChart.animateX(1000, Easing.EasingOption.Linear);

    //折線圖例 標簽 設置
    Legend legend = mBarChart.getLegend();
    legend.setForm(Legend.LegendForm.LINE);
    legend.setTextSize(11f);
    //顯示位置
    legend.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
    legend.setHorizontalAlignment(Legend.LegendHorizontalAlignment.LEFT);
    legend.setOrientation(Legend.LegendOrientation.HORIZONTAL);
    legend.setDrawInside(false);
    legend.setEnabled(false);

    //XY軸的設置
    //X軸設置顯示位置在底部
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setGranularity(1f);
    //保證Y軸從0開始,不然會上移一點
    leftAxis.setAxisMinimum(0f);
    rightAxis.setAxisMinimum(0f);
}
 
開發者ID:liuyongfeng90,項目名稱:JKCloud,代碼行數:42,代碼來源:BarChartManager.java

示例6: initTemperatureChart

import com.github.mikephil.charting.components.Legend; //導入方法依賴的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

示例7: initResistanceChart

import com.github.mikephil.charting.components.Legend; //導入方法依賴的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

示例8: onCreateView

import com.github.mikephil.charting.components.Legend; //導入方法依賴的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

示例9: initHumidityChart

import com.github.mikephil.charting.components.Legend; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
private void initHumidityChart() {

    m_lineChart.setDescription("");
    m_lineChart.setBackgroundColor(getResources().getColor(R.color.nothing));

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

    // enable scaling and dragging
    m_lineChart.setDragEnabled(true);
    m_lineChart.setScaleEnabled(false);
    m_lineChart.setScaleXEnabled(false);
    m_lineChart.setScaleYEnabled(false);

    m_lineChart.setPinchZoom(false);

    m_lineChart.setDrawGridBackground(false);

    XAxis x = m_lineChart.getXAxis();
    x.setPosition(XAxis.XAxisPosition.BOTTOM);
    x.setEnabled(false);
    x.setSpaceBetweenLabels(1);

    m_lineChart.getAxisRight().setEnabled(false);

    Legend l = m_lineChart.getLegend();
    l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);
    l.setForm(Legend.LegendForm.LINE);
    l.setFormSize(9f);
    l.setTextSize(11f);
    l.setXEntrySpace(4f);
}
 
開發者ID:ChanJLee,項目名稱:YunShuWeather,代碼行數:34,代碼來源:WeatherForecastActivity.java

示例10: setupPie

import com.github.mikephil.charting.components.Legend; //導入方法依賴的package包/類
private void setupPie(PieChart pieChart, int pos, float dados[], String labels[]) {


        List<PieEntry> entries = new ArrayList<>();
        int index = 0;
        for (float dado : dados) {
            entries.add(new PieEntry(dado, labels[index]));
            index++;
        }

        //entries.add(new PieEntry(24.0f, "Red"));
        //entries.add(new PieEntry(30.8f, "Blue"));

        PieDataSet set = new PieDataSet(entries, "");
        Description description = new Description();
        description.setText(" ");
        pieChart.setDescription(description);
        set.setColors(ColorTemplate.MATERIAL_COLORS);
        PieData data = new PieData(set);
        pieChart.setData(data);
        pieChart.invalidate();


        Legend l = pieChart.getLegend();
        l.setFormSize(15f); // set the size of the legend forms/shapes
        l.setForm(Legend.LegendForm.CIRCLE); // set what type of form/shape should be used
        l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
        l.setOrientation(Legend.LegendOrientation.VERTICAL);
        l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
        l.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
        l.setTextSize(18f);
        l.setTextColor(Color.BLACK);
        l.setXEntrySpace(5f); // set the space between the legend entries on the x-axis
        l.setYEntrySpace(5f);

        pieChart.animateXY(3000, 3000);

    }
 
開發者ID:ivoribeiro,項目名稱:AndroidQuiz,代碼行數:39,代碼來源:AdapterEstatisticasGraph.java

示例11: getFormattedPieChart

import com.github.mikephil.charting.components.Legend; //導入方法依賴的package包/類
/**
 * Formats a pie chart in a standardized way
 * @param c Context
 * @param p Pie chart
 * @param shouldShowLegend
 * @return the PieChart, whose data must be set and invalidated
 */
public static PieChart getFormattedPieChart(Context c, PieChart p, boolean shouldShowLegend) {
    Legend cLegend = p.getLegend();
    if (shouldShowLegend) {
        cLegend.setEnabled(true);
        cLegend.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
        cLegend.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
        cLegend.setOrientation(Legend.LegendOrientation.HORIZONTAL);
        cLegend.setDrawInside(false);
        cLegend.setForm(Legend.LegendForm.CIRCLE);
        cLegend.setTextSize(15);
        cLegend.setWordWrapEnabled(true);
    } else {
        cLegend.setEnabled(false);
    }

    p.setDrawEntryLabels(false);
    p.setDescription(EMPTY_CHART_DESCRIPTION);
    p.setHoleRadius(60f);
    p.setTransparentCircleRadius(65f);
    p.setCenterTextSize(20);

    if (SettingsActivity.getTheme(c) == SettingsActivity.THEME_NOIR) {
        int colorPrimaryNoir = ContextCompat.getColor(c, R.color.colorPrimaryNoir);
        int colorPrimaryTextNoir = ContextCompat.getColor(c, R.color.colorPrimaryTextNoir);

        p.setHoleColor(colorPrimaryNoir);
        p.setTransparentCircleColor(colorPrimaryNoir);
        p.setCenterTextColor(colorPrimaryTextNoir);
        cLegend.setTextColor(colorPrimaryTextNoir);
    }

    p.setRotationEnabled(false);

    p.setOnChartValueSelectedListener(new PieChartListener(p));
    return p;
}
 
開發者ID:lloydtorres,項目名稱:stately,代碼行數:44,代碼來源:RaraHelper.java

示例12: createChart

import com.github.mikephil.charting.components.Legend; //導入方法依賴的package包/類
private static void createChart(Chart barChart, List<Pair<String, Integer>> chartData, String title, Context context){

        int count = chartData.size() > 10 ? 10 : chartData.size();

        String[] stateNames = new String[count];
        for (int i=0; i<count; ++i) {
            Pair<String, Integer> record = chartData.get(i);
            stateNames[i] = record.first;
        }

        StateAxisValueFormatter stateAxisValueFormatter = new StateAxisValueFormatter(stateNames);

        barChart.getDescription().setEnabled(false);
        barChart.setTouchEnabled(false);

        XAxis xl = barChart.getXAxis();
        xl.setPosition(XAxis.XAxisPosition.BOTTOM);
        xl.setDrawAxisLine(true);
        xl.setDrawGridLines(true);
        xl.setGridLineWidth(0.3f);
        xl.setTextSize(11f);
        xl.setTextColor(Color.BLACK);
        xl.setLabelCount(count);
        xl.setValueFormatter(stateAxisValueFormatter);

        // setting data
        Legend l = barChart.getLegend();
        l.setDirection(Legend.LegendDirection.LEFT_TO_RIGHT);
        l.setFormSize(11f);
        l.setTextSize(11f);
        l.setXEntrySpace(4f);

        setData(barChart, chartData, title,context);
    }
 
開發者ID:fga-gpp-mds,項目名稱:2016.2-CidadeDemocratica,代碼行數:35,代碼來源:CharterGenerator.java

示例13: setupChart

import com.github.mikephil.charting.components.Legend; //導入方法依賴的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

示例14: onCreate

import com.github.mikephil.charting.components.Legend; //導入方法依賴的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

示例15: onCreate

import com.github.mikephil.charting.components.Legend; //導入方法依賴的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


注:本文中的com.github.mikephil.charting.components.Legend.setTextSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。