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


Java XAxis.setAxisMaximum方法代碼示例

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


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

示例1: dataSortedOnDay

import com.github.mikephil.charting.components.XAxis; //導入方法依賴的package包/類
private void dataSortedOnDay(int year, int month, int dayOfMonth) {
    if (graphValuesQuery != null)
        graphValuesQuery.removeEventListener(graphValuesListener);

    XAxis xaxis = chart.getXAxis();
    //xaxis.setTextSize(18f);
    xaxis.setDrawLabels(true);
    xaxis.setAxisMinimum(-0.5f);
    xaxis.setAxisMaximum(23.5f);
    xaxis.setPosition(XAxis.XAxisPosition.BOTTOM_INSIDE);

    chart.getData().getDataSetByIndex(0).clear();
    getBarData().getDataSetByIndex(0).setLabel(getString(R.string.hour_of_day_string));

    String path = String.format("/cow_data/%s/%d/%d/%d", cowId, year, month, dayOfMonth);
    graphValuesQuery = FirebaseHelper.getInstance().getDatabase().getReference().child(path).orderByKey();

    graphValuesQuery.addChildEventListener(graphValuesListener);
}
 
開發者ID:ekalyvio,項目名稱:CowBit,代碼行數:20,代碼來源:CowDetailsActivity.java

示例2: dataSortedOnYear

import com.github.mikephil.charting.components.XAxis; //導入方法依賴的package包/類
private void dataSortedOnYear(int year) {
    if (graphValuesQuery != null)
        graphValuesQuery.removeEventListener(graphValuesListener);

    XAxis xaxis = chart.getXAxis();
    //xaxis.setTextSize(18f);
    xaxis.setDrawLabels(true);
    xaxis.setAxisMinimum(0.5f);
    xaxis.setAxisMaximum(12.5f);
    xaxis.setPosition(XAxis.XAxisPosition.BOTTOM_INSIDE);

    chart.getData().getDataSetByIndex(0).clear();
    getBarData().getDataSetByIndex(0).setLabel(getString(R.string.month_of_year_string));

    String path = String.format("/cow_data/%s/%d", cowId, year);
    graphValuesQuery = FirebaseHelper.getInstance().getDatabase().getReference().child(path).orderByKey();

    graphValuesQuery.addChildEventListener(graphValuesListener);
}
 
開發者ID:ekalyvio,項目名稱:CowBit,代碼行數:20,代碼來源:CowDetailsActivity.java

示例3: setXAxis

import com.github.mikephil.charting.components.XAxis; //導入方法依賴的package包/類
private void setXAxis(int epochs) {
    final XAxis axis = mChart.getXAxis();
    axis.setEnabled(true);
    axis.setAxisMinimum(1F);
    axis.setAxisMaximum(epochs);
    axis.setPosition(XAxis.XAxisPosition.BOTTOM);
    axis.setDrawAxisLine(true);
    axis.setDrawGridLines(false);
    axis.setGranularity(1F);
    axis.setAvoidFirstLastClipping(true);

    mChart.getAxisRight().setDrawAxisLine(true);
}
 
開發者ID:huazhouwang,項目名稱:Synapse,代碼行數:14,代碼來源:ModelDetailActivity.java

示例4: setupXAxis

import com.github.mikephil.charting.components.XAxis; //導入方法依賴的package包/類
private void setupXAxis(BarLineChartBase chart, IAxisValueFormatter formatter) {
    XAxis x = chart.getXAxis();
    x.setGranularity(1.0f);
    x.setDrawGridLines(false);
    x.setPosition(XAxis.XAxisPosition.BOTTOM);
    x.setDrawAxisLine(false);
    x.setCenterAxisLabels(true);
    x.setAxisMinimum(2.0f);
    x.setAxisMaximum(5.0f);
    x.setValueFormatter(formatter);
}
 
開發者ID:jasonwyatt,項目名稱:SQLite-Performance,代碼行數:12,代碼來源:TestSuiteFragment.java

示例5: dataSortedOnMonth

import com.github.mikephil.charting.components.XAxis; //導入方法依賴的package包/類
private void dataSortedOnMonth(int year, int month) {
    if (graphValuesQuery != null)
        graphValuesQuery.removeEventListener(graphValuesListener);

    int iMonth = month - 1; // 1 (months begin with 0)

    // Create a calendar object and set year and month
    Calendar mycal = new GregorianCalendar(year, iMonth, 1);

    // Get the number of days in that month
    int daysInMonth = mycal.getActualMaximum(Calendar.DAY_OF_MONTH);

    XAxis xaxis = chart.getXAxis();
    //xaxis.setTextSize(18f);
    xaxis.setDrawLabels(true);
    xaxis.setAxisMinimum(0.5f);
    xaxis.setAxisMaximum(daysInMonth + 0.5f);
    xaxis.setPosition(XAxis.XAxisPosition.BOTTOM_INSIDE);

    chart.getData().getDataSetByIndex(0).clear();
    getBarData().getDataSetByIndex(0).setLabel(getString(R.string.day_of_month_string));

    String path = String.format("/cow_data/%s/%d/%d", cowId, year, month);
    graphValuesQuery = FirebaseHelper.getInstance().getDatabase().getReference().child(path).orderByKey();

    graphValuesQuery.addChildEventListener(graphValuesListener);
}
 
開發者ID:ekalyvio,項目名稱:CowBit,代碼行數:28,代碼來源:CowDetailsActivity.java

示例6: configureWeatherChart

import com.github.mikephil.charting.components.XAxis; //導入方法依賴的package包/類
/**
 * Configure styles of weather charts.
 *
 * @param entries   chart data.
 * @param formatter value formatter.
 * @param minVal    min value to show.
 * @param maxVal    max value to show.
 * @return chart formatted.
 */
private LineDataSet configureWeatherChart(
        LineChart chart, int chartName, int colorLineTempChart, int colorFillTempChart,
        List<Entry> entries, IAxisValueFormatter formatter, double minVal, double maxVal) {
    LineDataSet lineDataSet = new LineDataSet(entries, getString(chartName));
    lineDataSet.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER);
    lineDataSet.setDrawValues(false);
    lineDataSet.setValueTextSize(10f);
    lineDataSet.setDrawCircles(false);
    lineDataSet.setLineWidth(1.8f);
    lineDataSet.setColor(ContextCompat.getColor(getContext(), colorLineTempChart));
    lineDataSet.setLineWidth(2f);
    lineDataSet.setDrawFilled(true);
    lineDataSet.setFillColor(ContextCompat.getColor(getContext(), colorFillTempChart));
    lineDataSet.setFillAlpha(255);
    // General setup
    chart.setDrawGridBackground(false);
    chart.setDrawBorders(false);
    chart.setViewPortOffsets(0, 0, 0, 0);
    chart.getDescription().setEnabled(false);
    chart.getLegend().setEnabled(false);
    chart.setTouchEnabled(false);
    // X axis setup
    XAxis xAxis = chart.getXAxis();
    xAxis.setEnabled(false);
    xAxis.setAxisMinimum(0);
    xAxis.setAxisMaximum(lastTimestamp);
    // Y axis setup
    YAxis leftAxis = chart.getAxisLeft();
    leftAxis.setEnabled(false);
    leftAxis.setAxisMaximum((float) (maxVal));
    leftAxis.setAxisMinimum((float) (minVal));
    YAxis rightAxis = chart.getAxisRight();
    rightAxis.setAxisMaximum((float) (maxVal));
    rightAxis.setAxisMinimum((float) (minVal));
    rightAxis.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
    rightAxis.setValueFormatter(formatter);
    return lineDataSet;
}
 
開發者ID:davidmigloz,項目名稱:go-bees,代碼行數:48,代碼來源:RecordingFragment.java

示例7: recalculateXAxis

import com.github.mikephil.charting.components.XAxis; //導入方法依賴的package包/類
private void recalculateXAxis() {
    final XAxis xAxis = barChart.getXAxis();
    xAxis.setAxisMinimum(0);
    xAxis.setAxisMaximum(histogramData.getNumBins());
    barChart.notifyDataSetChanged();
    barChart.invalidate();
}
 
開發者ID:google,項目名稱:walt,代碼行數:8,代碼來源:HistogramChart.java

示例8: onCreate

import com.github.mikephil.charting.components.XAxis; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_combined);

    mChart = (CombinedChart) findViewById(R.id.chart1);
    mChart.getDescription().setEnabled(false);
    mChart.setBackgroundColor(Color.WHITE);
    mChart.setDrawGridBackground(false);
    mChart.setDrawBarShadow(false);
    mChart.setHighlightFullBarEnabled(false);

    // draw bars behind lines
    mChart.setDrawOrder(new DrawOrder[]{
            DrawOrder.BAR, DrawOrder.BUBBLE, DrawOrder.CANDLE, DrawOrder.LINE, DrawOrder.SCATTER
    });

    Legend l = mChart.getLegend();
    l.setWordWrapEnabled(true);
    l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
    l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
    l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
    l.setDrawInside(false);

    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setDrawGridLines(false);
    rightAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setDrawGridLines(false);
    leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)

    XAxis xAxis = mChart.getXAxis();
    xAxis.setPosition(XAxisPosition.BOTH_SIDED);
    xAxis.setAxisMinimum(0f);
    xAxis.setGranularity(1f);
    xAxis.setValueFormatter(new IAxisValueFormatter() {
        @Override
        public String getFormattedValue(float value, AxisBase axis) {
            return mMonths[(int) value % mMonths.length];
        }
    });

    CombinedData data = new CombinedData();

    data.setData(generateLineData());
    data.setData(generateBarData());
    data.setData(generateBubbleData());
    data.setData(generateScatterData());
    data.setData(generateCandleData());
    data.setValueTypeface(mTfLight);

    xAxis.setAxisMaximum(data.getXMax() + 0.25f);

    mChart.setData(data);
    mChart.invalidate();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:60,代碼來源:CombinedChartActivity.java

示例9: initChart

import com.github.mikephil.charting.components.XAxis; //導入方法依賴的package包/類
protected void initChart() {
    mCombinedChart.getDescription().setEnabled(false);
    mCombinedChart.setBackgroundColor(Color.WHITE);
    mCombinedChart.setDrawGridBackground(false);
    mCombinedChart.setDrawBarShadow(false);
    mCombinedChart.setHighlightFullBarEnabled(false);

    // draw bars behind lines
    mCombinedChart.setDrawOrder(new CombinedChart.DrawOrder[]{
            CombinedChart.DrawOrder.BAR, CombinedChart.DrawOrder.BUBBLE,
            CombinedChart.DrawOrder.CANDLE, CombinedChart.DrawOrder.LINE,
            CombinedChart.DrawOrder.SCATTER
    });

    Legend l = mCombinedChart.getLegend();
    l.setWordWrapEnabled(true);
    l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
    l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
    l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
    l.setDrawInside(false);

    YAxis rightAxis = mCombinedChart.getAxisRight();
    rightAxis.setDrawGridLines(false);
    rightAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)

    YAxis leftAxis = mCombinedChart.getAxisLeft();
    leftAxis.setDrawGridLines(false);
    leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)

    XAxis xAxis = mCombinedChart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTH_SIDED);
    xAxis.setAxisMinimum(0f);
    xAxis.setGranularity(1f);
    xAxis.setValueFormatter(new IAxisValueFormatter() {
        @Override
        public String getFormattedValue(float value, AxisBase axis) {
            return mMonths[(int) value % mMonths.length];
        }
    });

    CombinedData data = new CombinedData();

    data.setData(generateLineData());
    data.setData(generateBarData());
    data.setData(generateBubbleData());
    data.setData(generateScatterData());
    data.setData(generateCandleData());
    //data.setValueTypeface(mTfLight);

    xAxis.setAxisMaximum(data.getXMax() + 0.25f);

    mCombinedChart.setData(data);
    mCombinedChart.invalidate();
}
 
開發者ID:igrow-systems,項目名稱:igrow-android,代碼行數:55,代碼來源:EnvironmentalSensorDetailFragment.java

示例10: initChart

import com.github.mikephil.charting.components.XAxis; //導入方法依賴的package包/類
/**
     * 初始化報表
     *
     * @param showAnimation 是否顯示動畫
     */
    void initChart(boolean showAnimation) {

        int screenWidth = Utils.getScreenWidth(mContext);
        combinedChart.getLayoutParams().height = screenWidth * 300 / 640;

        //啟用縮放和拖動
        combinedChart.setDragEnabled(true);//拖動
        combinedChart.setScaleEnabled(false);//縮放
        combinedChart.setOnChartValueSelectedListener(this);
        combinedChart.getDescription().setEnabled(false);
        combinedChart.setBackgroundColor(ContextCompat.getColor(mContext, R.color.co10));
        combinedChart.setDrawGridBackground(false);
        combinedChart.setDrawBarShadow(false);
        combinedChart.setHighlightFullBarEnabled(false);

        Legend l = combinedChart.getLegend();
        l.setForm(Legend.LegendForm.NONE);//底部樣式
        l.setTextColor(ContextCompat.getColor(mContext, R.color.transparent));
        l.setWordWrapEnabled(false);
        l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
        l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
        l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
        l.setDrawInside(false);

        YAxis rightAxis = combinedChart.getAxisRight();
        rightAxis.setEnabled(false);

        YAxis leftAxis = combinedChart.getAxisLeft();
        leftAxis.setDrawGridLines(false);
        leftAxis.setGranularityEnabled(false);
        leftAxis.setDrawAxisLine(false);
        leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
        leftAxis.setTextColor(ContextCompat.getColor(mContext, R.color.co4));

        updateTitle(items.get(dateSelected));
        XAxis xAxis = combinedChart.getXAxis();
        xAxis.setTypeface(mTfLight);
        xAxis.setEnabled(true);//設置軸啟用或禁用 如果禁用以下的設置全部不生效
        xAxis.setDrawAxisLine(true);//是否繪製軸線
        xAxis.setDrawGridLines(false);//設置x軸上每個點對應的線
        xAxis.setDrawLabels(true);//繪製標簽  指x軸上的對應數值
        xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);//設置x軸的顯示位置
        xAxis.setTextSize(10f); //設置X軸文字大小
        xAxis.setGranularityEnabled(true);//是否允許X軸上值重複出現
        xAxis.setTextColor(ContextCompat.getColor(this, R.color.co4));//設置X軸文字顏色
//        //設置豎線的顯示樣式為虛線
//        //lineLength控製虛線段的長度
//        //spaceLength控製線之間的空間
        xAxis.enableGridDashedLine(10f, 10f, 0f);
        xAxis.setAxisMinimum(0f);//設置x軸的最小值
        xAxis.setAxisMaximum(mDatas.length);//設置最大值
        xAxis.setAvoidFirstLastClipping(true);//圖表將避免第一個和最後一個標簽條目被減掉在圖表或屏幕的邊緣
        xAxis.setLabelRotationAngle(0f);//設置x軸標簽字體的旋轉角度
//        設置x軸顯示標簽數量  還有一個重載方法第二個參數為布爾值強製設置數量 如果啟用會導致繪製點出現偏差
        xAxis.setLabelCount(10);
        xAxis.setGridLineWidth(10f);//設置豎線大小
//        xAxis.setGridColor(Color.RED);//設置豎線顏色
        xAxis.setAxisLineColor(Color.GRAY);//設置x軸線顏色
        xAxis.setAxisLineWidth(1f);//設置x軸線寬度

        CombinedData combinedData = new CombinedData();
        combinedData.setData(generateLineData());
        combinedData.setData(generateBarData());
        combinedData.setValueTypeface(mTfLight);
        xAxis.setAxisMaximum(combinedData.getXMax() + 0.25f);
        //X軸的數據格式
        ValueFormatter xAxisFormatter = new ValueFormatter(combinedChart);
        xAxisFormatter.setmValues(xAxisValue);
        xAxis.setValueFormatter(xAxisFormatter);//格式化x軸標簽顯示字符
        combinedChart.setData(combinedData);
        combinedChart.invalidate();
        if (showAnimation) {
            combinedChart.animateY(2000);
        }
    }
 
開發者ID:jay16,項目名稱:shengyiplus-android,代碼行數:81,代碼來源:HomeTricsActivity.java

示例11: onCreate

import com.github.mikephil.charting.components.XAxis; //導入方法依賴的package包/類
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mChart = (CombinedChart) findViewById(R.id.chart1);
        //描述
        mChart.getDescription().setEnabled(false);

        mChart.setBackgroundColor(Color.WHITE);

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

        mChart.setScaleEnabled(false);
        mChart.setScaleYEnabled(false);
        mChart.setScaleXEnabled(false);

        mChart.setPinchZoom(false);
//        mChart.setScaleMinima(2f, 1f);
//        mChart.setAutoScaleMinMaxEnabled(true);

        // draw bars behind lines
        mChart.setDrawOrder(new CombinedChart.DrawOrder[]{
                CombinedChart.DrawOrder.BAR
        });

        //圖例
        Legend l = mChart.getLegend();
        l.setWordWrapEnabled(true);
        l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
        l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
        l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
        l.setDrawInside(false);


        YAxis rightAxis = mChart.getAxisRight();
        rightAxis.setEnabled(false);
        rightAxis.setAxisMinimum(0f);

        YAxis leftAxis = mChart.getAxisLeft();
        leftAxis.setEnabled(false);
        leftAxis.setAxisMinimum(0f);

        XAxis xAxis = mChart.getXAxis();
        xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
        xAxis.setDrawGridLines(false);
//        xAxis.setAvoidFirstLastClipping(true);
        xAxis.setAxisMinimum(0.5f);
        xAxis.setGranularity(1f);
        xAxis.setValueFormatter(new IAxisValueFormatter() {
            @Override
            public String getFormattedValue(float value, AxisBase axis) {
                if (value % 1 == 0&&value>=1) {
                    return mMonths[(int) value % mMonths.length-1];
                } else {
                    return "";
                }
            }
        });

        CombinedData data = new CombinedData();
        data.setData(generateBarData(1f, 1f));
        xAxis.setAxisMaximum(data.getXMax() + 0.25f);

        mChart.setData(data);
        mChart.setVisibleXRange(3, 5);
        mChart.setExtraOffsets(10, 0, 0, 0);
        mChart.invalidate();

    }
 
開發者ID:xsingHu,項目名稱:xs-android-architecture,代碼行數:73,代碼來源:MainActivity.java

示例12: onCreate

import com.github.mikephil.charting.components.XAxis; //導入方法依賴的package包/類
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mChart = (CombinedChart) findViewById(R.id.chart1);
        //描述
        mChart.getDescription().setEnabled(false);

        mChart.setBackgroundColor(Color.WHITE);

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

        mChart.setScaleEnabled(false);
        mChart.setScaleYEnabled(false);
        mChart.setScaleXEnabled(false);

        mChart.setPinchZoom(false);
//        mChart.setScaleMinima(2f, 1f);
//        mChart.setAutoScaleMinMaxEnabled(true);

        // draw bars behind lines
        mChart.setDrawOrder(new CombinedChart.DrawOrder[]{
                CombinedChart.DrawOrder.BAR
        });

        //圖例
        Legend l = mChart.getLegend();
        l.setWordWrapEnabled(true);
        l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
        l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
        l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
        l.setDrawInside(false);


        YAxis rightAxis = mChart.getAxisRight();
        rightAxis.setEnabled(false);
        rightAxis.setAxisMinimum(0f);

        YAxis leftAxis = mChart.getAxisLeft();
        leftAxis.setEnabled(false);
        leftAxis.setAxisMinimum(0f);

        XAxis xAxis = mChart.getXAxis();
        xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
        xAxis.setDrawGridLines(false);
//        xAxis.setAvoidFirstLastClipping(true);
        xAxis.setAxisMinimum(0.5f);
        xAxis.setGranularity(1f);
        xAxis.setValueFormatter(new IAxisValueFormatter() {
            @Override
            public String getFormattedValue(float value, AxisBase axis) {
                if (value % 1 == 0&&value>=1) {
                    return mMonths[(int) value % mMonths.length-1];
                } else {
                    return "";
                }
            }
        });

        CombinedData data = new CombinedData();
        data.setData(generateBarData(1f, 1f));
        xAxis.setAxisMaximum(data.getXMax() + 0.25f);

        mChart.setData(data);
        mChart.setVisibleXRange(4, 6);
        mChart.setExtraOffsets(10, 0, 0, 0);
        mChart.invalidate();

    }
 
開發者ID:xsingHu,項目名稱:xs-android-architecture,代碼行數:73,代碼來源:MainActivity2.java


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