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


Java Legend.setXEntrySpace方法代碼示例

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


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

示例1: setAxis

import com.github.mikephil.charting.components.Legend; //導入方法依賴的package包/類
@Override
public void setAxis(AnalysisXAxisValueFormatter formatter, float yAxisMaxValue) {

    XAxis xAxis = mRadarChart.getXAxis();
    xAxis.setTextSize(9f);
    xAxis.setYOffset(0f);
    xAxis.setXOffset(0f);
    xAxis.setValueFormatter(formatter);
    xAxis.setTextColor(Color.WHITE);

    YAxis yAxis = mRadarChart.getYAxis();
    yAxis.setLabelCount(5, false);
    yAxis.setTextSize(9f);
    yAxis.setAxisMinimum(0f);
    yAxis.setAxisMaximum(yAxisMaxValue);
    yAxis.setDrawLabels(false);

    Legend l = mRadarChart.getLegend();
    l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
    l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
    l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
    l.setDrawInside(false);
    l.setXEntrySpace(7f);
    l.setYEntrySpace(5f);
    l.setTextColor(Color.WHITE);
}
 
開發者ID:Alex-ZHOU,項目名稱:VMAndroid,代碼行數:27,代碼來源:AnalysisFragment.java

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

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

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

    mChart = (PieChart) findViewById(R.id.chart1);
    mChart.setUsePercentValues(true);
    mChart.getDescription().setEnabled(false);
    mChart.setExtraOffsets(5, 10, 5, 5);

    mChart.setDragDecelerationFrictionCoef(0.95f);

    mChart.setCenterTextTypeface(mTfLight);
    mChart.setCenterText(generateCenterSpannableText());

    mChart.setDrawHoleEnabled(true);
    mChart.setHoleColor(Color.WHITE);

    mChart.setTransparentCircleColor(Color.WHITE);
    mChart.setTransparentCircleAlpha(110);

    mChart.setHoleRadius(58f);
    mChart.setTransparentCircleRadius(61f);

    mChart.setDrawCenterText(true);

    mChart.setRotationAngle(0);
    // enable rotation of the chart by touch
    mChart.setRotationEnabled(true);
    mChart.setHighlightPerTapEnabled(true);

    // mChart.setUnit(" €");
    // mChart.setDrawUnitsInChart(true);

    // add a selection listener
    mChart.setOnChartValueSelectedListener(this);

    setData(4, 100);

    mChart.animateY(1400, Easing.EasingOption.EaseInOutQuad);
    // mChart.spin(2000, 0, 360);

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

    Legend l = mChart.getLegend();
    l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
    l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
    l.setOrientation(Legend.LegendOrientation.VERTICAL);
    l.setDrawInside(false);
    l.setXEntrySpace(7f);
    l.setYEntrySpace(0f);
    l.setYOffset(0f);

    // entry label styling
    mChart.setEntryLabelColor(Color.WHITE);
    mChart.setEntryLabelTypeface(mTfRegular);
    mChart.setEntryLabelTextSize(12f);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:70,代碼來源:PieChartActivity.java

示例3: configChart

import com.github.mikephil.charting.components.Legend; //導入方法依賴的package包/類
private void configChart(Station station, PieChart mChart) {
    mChart.setDescription("");
    mChart.setExtraOffsets(5, 10, 5, 5);

    mChart.setDragDecelerationFrictionCoef(0.95f);

    mChart.setCenterText(getString(R.string.base_state));

    mChart.setDrawHoleEnabled(true);
    mChart.setHoleColorTransparent(true);

    mChart.setUsePercentValues(false);

    mChart.setTransparentCircleColor(Color.WHITE);
    mChart.setTransparentCircleAlpha(110);

    mChart.setHoleRadius(58f);
    mChart.setTransparentCircleRadius(61f);

    mChart.setDrawCenterText(true);

    mChart.setTouchEnabled(false);
    mChart.setRotationEnabled(false);
    mChart.setRotationAngle(0);

    setData(mChart, station);

    mChart.animateY(1400, Easing.EasingOption.EaseInOutQuad);
    // mChart.spin(2000, 0, 360);

    Legend l = mChart.getLegend();
    l.setEnabled(false);
    l.setPosition(Legend.LegendPosition.RIGHT_OF_CHART);
    l.setXEntrySpace(7f);
    l.setYEntrySpace(0f);
    l.setYOffset(0f);
}
 
開發者ID:Mun0n,項目名稱:MADBike,代碼行數:38,代碼來源:MapFragment.java

示例4: bindTo

import com.github.mikephil.charting.components.Legend; //導入方法依賴的package包/類
@Override
public void bindTo(Station value) {
    nameTextView.setText(value.getNumberStation() + " " + value.getNombre());
    streetTextView.setText(value.getAddress());
    mChart.setDescription("");
    mChart.setExtraOffsets(5, 10, 5, 5);

    mChart.setDragDecelerationFrictionCoef(0.95f);

    mChart.setCenterText(context.getString(R.string.base_state));

    mChart.setDrawHoleEnabled(true);
    mChart.setHoleColorTransparent(true);

    mChart.setUsePercentValues(false);

    mChart.setTransparentCircleColor(Color.WHITE);
    mChart.setTransparentCircleAlpha(110);

    mChart.setHoleRadius(58f);
    mChart.setTransparentCircleRadius(61f);

    mChart.setDrawCenterText(true);

    mChart.setTouchEnabled(false);
    mChart.setRotationEnabled(false);
    mChart.setRotationAngle(0);

    setData(value);

    mChart.animateY(1400, Easing.EasingOption.EaseInOutQuad);
    // mChart.spin(2000, 0, 360);

    Legend l = mChart.getLegend();
    l.setPosition(Legend.LegendPosition.RIGHT_OF_CHART);
    l.setXEntrySpace(7f);
    l.setYEntrySpace(0f);
    l.setYOffset(0f);
}
 
開發者ID:Mun0n,項目名稱:MADBike,代碼行數:40,代碼來源:StationHolder.java

示例5: setHorizontalBarChart

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

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

示例7: init

import com.github.mikephil.charting.components.Legend; //導入方法依賴的package包/類
private void init(Context context, AttributeSet attrs, int defStyle) {
    setUsePercentValues(true);
    getDescription().setEnabled(false);
    setExtraOffsets(5, 10, 5, 5);
    setDragDecelerationFrictionCoef(0.95f);

    setDrawHoleEnabled(true);
    setHoleColor(Color.WHITE);

    setTransparentCircleColor(Color.WHITE);
    setTransparentCircleAlpha(110);

    setHoleRadius(58f);
    setTransparentCircleRadius(61f);

    setDrawCenterText(true);

    setRotationAngle(0);
    setRotationEnabled(true);
    setHighlightPerTapEnabled(true);


    Legend l = getLegend();
    l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
    l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
    l.setOrientation(Legend.LegendOrientation.VERTICAL);
    l.setTextColor(Color.GRAY);
    l.setDrawInside(false);
    l.setXEntrySpace(7f);
    l.setYEntrySpace(0f);
    l.setYOffset(0f);

    setEntryLabelColor(Color.GRAY);
    setEntryLabelTextSize(12f);
}
 
開發者ID:VidyaSastry,項目名稱:Opal-Chat-AnalyticsDashboard,代碼行數:36,代碼來源:MyPieChart.java

示例8: init

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

    XAxis xl = getXAxis();
    xl.setPosition(XAxis.XAxisPosition.BOTTOM);
    xl.setDrawAxisLine(true);
    xl.setDrawGridLines(false);
    xl.setGranularity(10f);
    xl.setTextColor(Color.GRAY);

    YAxis yl = getAxisLeft();
    yl.setDrawAxisLine(false);
    yl.setDrawGridLines(false);
    yl.setDrawLabels(false);
    yl.setAxisMinimum(0f);
    yl.setTextColor(Color.GRAY);

    YAxis yr = getAxisRight();
    yr.setDrawAxisLine(true);
    yr.setDrawGridLines(false);
    yr.setAxisMinimum(0f);
    yl.setTextColor(Color.GRAY);

    setFitBars(true);
    animateY(2500);

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

}
 
開發者ID:VidyaSastry,項目名稱:Opal-Chat-AnalyticsDashboard,代碼行數:40,代碼來源:MyHorizontalBarChart.java

示例9: setDefaultPieChartProperties

import com.github.mikephil.charting.components.Legend; //導入方法依賴的package包/類
private void setDefaultPieChartProperties(AndiCarPieChart pieChart) {
    pieChart.setUsePercentValues(false);
    pieChart.getDescription().setEnabled(false);
    pieChart.setDrawEntryLabels(false);
    pieChart.setDragDecelerationFrictionCoef(0.95f);
    pieChart.setDrawHoleEnabled(false);
    pieChart.setRotationAngle(0);
    //disable rotation of the chart by touch
    pieChart.setRotationEnabled(false);
    pieChart.setHighlightPerTapEnabled(false);

    pieChart.animateY(700, Easing.EasingOption.EaseInOutQuad);
    // entry label styling
    pieChart.setEntryLabelColor(Color.WHITE);
    pieChart.setTouchEnabled(true);

    Legend l = pieChart.getLegend();
    if (mChartsLine.getTag() != null && mChartsLine.getTag().equals(getResources().getString(R.string.chart_key_legendAtRight))) {
        l.setVerticalAlignment(Legend.LegendVerticalAlignment.CENTER);
        l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
    }
    else {
        l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
        l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
    }
    l.setOrientation(Legend.LegendOrientation.VERTICAL);
    l.setDrawInside(false);
    l.setXEntrySpace(7f);
    l.setYEntrySpace(0f);
    l.setYOffset(10f);
}
 
開發者ID:mkeresztes,項目名稱:AndiCar,代碼行數:32,代碼來源:PieChartsComponent.java

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

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

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

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

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

    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

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


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