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


Java YAxis.setPosition方法代码示例

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


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

示例1: setupYAxis

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

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

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

示例2: initHeartRateChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
private void initHeartRateChart(LineChart mChart) {
    mChart.setViewPortOffsets(0, 0, 0, 0);
    mChart.setBackgroundColor(getResources().getColor(R.color.gold_pressed));
    mChart.setDescription("Heart Rate");
    mChart.setTouchEnabled(true);
    mChart.setDragEnabled(true);
    mChart.setScaleEnabled(true);
    mChart.setPinchZoom(false);
    mChart.setDrawGridBackground(false);
    mChart.setMaxHighlightDistance(300);

    XAxis xAxis = mChart.getXAxis();
    xAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
    xAxis.setTextSize(11f);
    xAxis.setTextColor(Color.WHITE);
    xAxis.setDrawGridLines(false);
    xAxis.setDrawAxisLine(false);

    YAxis y = mChart.getAxisLeft();
    y.setTypeface(BandApplication.INSTANCE.getTfLight());
    y.setLabelCount(6, false);
    y.setTextColor(Color.RED);
    y.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
    y.setDrawGridLines(false);
    y.setAxisLineColor(Color.WHITE);

    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
    y.setLabelCount(6, false);
    y.setTextColor(Color.RED);
    y.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
    y.setDrawGridLines(false);
    y.setAxisLineColor(Color.WHITE);

    mChart.getLegend().setEnabled(false);
    mChart.animateXY(2000, 2000);
}
 
开发者ID:qizhenghao,项目名称:Microsoft_Band,代码行数:38,代码来源:HeartRateFragment.java

示例3: chartYAxisStyling

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void chartYAxisStyling(YAxis yAxis) {
    yAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
    yAxis.setTextColor(SettingsActivity.ThemePreferenceFragment.isLight(getContext()) ?
            getResources().getColor(R.color.traffic_chart_text_color_light) :
            getResources().getColor(R.color.traffic_chart_text_color_dark));
    yAxis.setDrawGridLines(false);
    yAxis.setGranularityEnabled(true);
    yAxis.setDrawAxisLine(true);
}
 
开发者ID:DmitryMalkovich,项目名称:gito-github-client,代码行数:11,代码来源:TrafficFragment.java

示例4: initChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
 * initiliaze chart
 */
private void initChart() {
    mChart = (BarChart) findViewById(R.id.chart1);
    mChart.setDrawBarShadow(false);
    mChart.setDrawValueAboveBar(true);
    mChart.setDescription("");
    // if more than 60 entries are displayed in the chart, no values will be
    // drawn
    mChart.setMaxVisibleValueCount(60);
    // scaling can now only be done on x- and y-axis separately
    mChart.setPinchZoom(false);
    mChart.setDrawGridBackground(false);
    mChart.setDescriptionColor(Color.parseColor("#000000"));

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

    YAxisValueFormatter custom = new DataAxisFormatter("%");

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setValueFormatter(custom);
    leftAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);

    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setValueFormatter(custom);
    rightAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);

    leftAxis.setDrawGridLines(true);
    rightAxis.setDrawGridLines(false);

    mChart.animateY(1000);

    mChart.getLegend().setEnabled(true);

    mChart.setVisibility(View.GONE);
}
 
开发者ID:bertrandmartel,项目名称:bluetooth-le-analyzer,代码行数:41,代码来源:AnalyzerActivity.java

示例5: configureWeatherChart

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

示例6: setupChart

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

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

    YAxisValueFormatter custom = new PercentFormatter();

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

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

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

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

示例7: initChart

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

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


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

示例8: initChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
 * 初始化图表
 *
 * @param chart 原始图表
 * @return 初始化后的图表
 */
public static LineChart initChart(LineChart chart) {
    // 不显示数据描述
    chart.getDescription().setEnabled(false);
    // 没有数据的时候,显示“暂无数据”
    chart.setNoDataText("暂无数据");
    // 不显示表格颜色
    chart.setDrawGridBackground(false);
    // 不可以缩放
    chart.setScaleEnabled(false);
    // 不显示y轴右边的值
    chart.getAxisRight().setEnabled(false);
    // 不显示图例
    Legend legend = chart.getLegend();
    legend.setEnabled(false);
    // 向左偏移15dp,抵消y轴向右偏移的30dp
    chart.setExtraLeftOffset(-15);

    XAxis xAxis = chart.getXAxis();
    // 不显示x轴
    xAxis.setDrawAxisLine(false);
    // 设置x轴数据的位置
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setTextColor(Color.WHITE);
    xAxis.setTextSize(12);
    xAxis.setGridColor(Color.parseColor("#30FFFFFF"));
    // 设置x轴数据偏移量
    xAxis.setYOffset(-12);

    YAxis yAxis = chart.getAxisLeft();
    // 不显示y轴
    yAxis.setDrawAxisLine(false);
    // 设置y轴数据的位置
    yAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
    // 不从y轴发出横向直线
    yAxis.setDrawGridLines(false);
    yAxis.setTextColor(Color.WHITE);
    yAxis.setTextSize(12);
    // 设置y轴数据偏移量
    yAxis.setXOffset(30);
    yAxis.setYOffset(-3);
    yAxis.setAxisMinimum(0);

    //Matrix matrix = new Matrix();
    // x轴缩放1.5倍
    //matrix.postScale(1.5f, 1f);
    // 在图表动画显示之前进行缩放
    //chart.getViewPortHandler().refresh(matrix, chart, false);
    // x轴执行动画
    //chart.animateX(2000);
    chart.invalidate();
    return chart;
}
 
开发者ID:alidili,项目名称:Demos,代码行数:59,代码来源:ChartUtils.java

示例9: onCreate

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

    tvX = (TextView) findViewById(R.id.tvXMax);
    mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
    mSeekBarX.setProgress(100);
    tvX.setText("100");

    mSeekBarX.setOnSeekBarChangeListener(this);

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

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

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

    mChart.setDragDecelerationFrictionCoef(0.9f);

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

    // set an alternative background color
    mChart.setBackgroundColor(Color.WHITE);
    mChart.setViewPortOffsets(0f, 0f, 0f, 0f);

    // add data
    setData(100, 30);
    mChart.invalidate();

    // get the legend (only possible after setting data)
    Legend l = mChart.getLegend();
    l.setEnabled(false);

    XAxis xAxis = mChart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.TOP_INSIDE);
    xAxis.setTypeface(mTfLight);
    xAxis.setTextSize(10f);
    xAxis.setTextColor(Color.WHITE);
    xAxis.setDrawAxisLine(false);
    xAxis.setDrawGridLines(true);
    xAxis.setTextColor(Color.rgb(255, 192, 56));
    xAxis.setCenterAxisLabels(true);
    xAxis.setGranularity(1f); // one hour
    xAxis.setValueFormatter(new IAxisValueFormatter() {

        private SimpleDateFormat mFormat = new SimpleDateFormat("dd MMM HH:mm");

        @Override
        public String getFormattedValue(float value, AxisBase axis) {

            long millis = TimeUnit.HOURS.toMillis((long) value);
            return mFormat.format(new Date(millis));
        }
    });

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
    leftAxis.setTypeface(mTfLight);
    leftAxis.setTextColor(ColorTemplate.getHoloBlue());
    leftAxis.setDrawGridLines(true);
    leftAxis.setGranularityEnabled(true);
    leftAxis.setAxisMinimum(0f);
    leftAxis.setAxisMaximum(170f);
    leftAxis.setYOffset(-9f);
    leftAxis.setTextColor(Color.rgb(255, 192, 56));

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

示例10: onCreate

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

    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(45);
    mSeekBarY.setProgress(100);

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

    mChart = (LineChart) findViewById(R.id.chart1);
    mChart.setViewPortOffsets(0, 0, 0, 0);
    mChart.setBackgroundColor(Color.rgb(104, 241, 175));

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

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

    // 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);

    mChart.setDrawGridBackground(false);
    mChart.setMaxHighlightDistance(300);
    
    XAxis x = mChart.getXAxis();
    x.setEnabled(false);
    
    YAxis y = mChart.getAxisLeft();
    y.setTypeface(mTfLight);
    y.setLabelCount(6, false);
    y.setTextColor(Color.WHITE);
    y.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
    y.setDrawGridLines(false);
    y.setAxisLineColor(Color.WHITE);
    
    mChart.getAxisRight().setEnabled(false);

    // add data
    setData(45, 100);
    
    mChart.getLegend().setEnabled(false);
    
    mChart.animateXY(2000, 2000);

    // dont forget to refresh the drawing
    mChart.invalidate();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:63,代码来源:CubicLineChartActivity.java

示例11: init

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

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

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

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

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

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

示例12: setupChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
private void setupChart(LineChart chart, LineData data, int color) {
    ((LineDataSet) data.getDataSetByIndex(0)).setCircleColorHole(color);
    chart.getDescription().setEnabled(false);
    chart.setDrawGridBackground(false);
    chart.setTouchEnabled(false);
    chart.setDragEnabled(false);
    chart.setScaleEnabled(true);
    chart.setPinchZoom(false);
    chart.setBackgroundColor(color);
    chart.setViewPortOffsets(0, 23, 0, 0);
    chart.setData(data);
    Legend l = chart.getLegend();
    l.setEnabled(false);

    chart.getAxisLeft().setEnabled(true);
    chart.getAxisLeft().setDrawGridLines(false);
    chart.getAxisLeft().setDrawAxisLine(false);
    chart.getAxisLeft().setSpaceTop(10);
    chart.getAxisLeft().setSpaceBottom(30);
    chart.getAxisLeft().setAxisLineColor(0xFFFFFF);
    chart.getAxisLeft().setTextColor(0xFFFFFF);
    chart.getAxisLeft().setDrawTopYLabelEntry(true);
    chart.getAxisLeft().setLabelCount(10);

    chart.getXAxis().setEnabled(true);
    chart.getXAxis().setDrawGridLines(false);
    chart.getXAxis().setDrawAxisLine(false);
    chart.getXAxis().setAxisLineColor(0xFFFFFF);
    chart.getXAxis().setTextColor(0xFFFFFF);

    Typeface tf = Typeface.DEFAULT;

    // X Axis
    XAxis xAxis = chart.getXAxis();
    xAxis.setTypeface(tf);
    xAxis.removeAllLimitLines();

    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM_INSIDE);

    xAxis.setTextColor(Color.argb(150, 255, 255, 255));

    if (displayType == 1 || displayType == 2) // Week and Month
        xAxis.setValueFormatter(new WeekXFormatter());
    else if (displayType == 0) //  Day
        xAxis.setValueFormatter(new HourXFormatter());
    else
        xAxis.setValueFormatter(new YearXFormatter()); // Year

    // Y Axis
    YAxis leftAxis = chart.getAxisLeft();
    leftAxis.removeAllLimitLines();
    leftAxis.setTypeface(tf);
    leftAxis.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
    leftAxis.setTextColor(Color.argb(150, 255, 255, 255));
    leftAxis.setValueFormatter(new DontShowNegativeFormatter(displayInUsd));
    chart.getAxisRight().setEnabled(false); // Deactivates horizontal lines

    chart.animateX(1300);
    chart.notifyDataSetChanged();
}
 
开发者ID:manuelsc,项目名称:Lunary-Ethereum-Wallet,代码行数:61,代码来源:FragmentPrice.java

示例13: onCreate

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_coin_detail);
//        overridePendingTransition(R.anim.right_in, R.anim.stay);
        initToolbar("Coin Details", R.drawable.ic_back_arrow);
        initUserAction("", 0, false);

        Bundle bundle = getIntent().getExtras();

        if (bundle != null) {
            coinTag = bundle.getString(Constants.COIN_TAG, "");
            coinName = bundle.getString(Constants.COIN_NAME, "");
        }

        tvCoinName.setText(coinName);

        mChart = (LineChart) findViewById(R.id.chart);
//        mChart.setPadding(4,4,4,4);

        // FIXME calculate offset for right
        mChart.setViewPortOffsets(6, 30, 90, 60);

        // no description text
        mChart.getDescription().setEnabled(false);
        mChart.setNoDataText("");

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

        // 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);

        mChart.setDrawGridBackground(false);
        mChart.setMaxHighlightDistance(300);

        XAxis x = mChart.getXAxis();
        x.setTextColor(ContextCompat.getColor(this, R.color.colorText));
        x.setPosition(XAxis.XAxisPosition.BOTTOM);
        x.setAxisLineColor(Color.TRANSPARENT);
        x.setDrawGridLines(false);
        x.setAxisLineWidth(0f);
        x.setGranularity(1f);
        x.setValueFormatter(new MyXAxisValueFormatter());
        x.setLabelRotationAngle(315);

        YAxis y = mChart.getAxisRight();
//        y.setTypeface();
        y.setLabelCount(6, false);
        y.setTextColor(ContextCompat.getColor(this, R.color.colorText));
        y.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
        y.setDrawGridLines(true);
        y.setAxisLineColor(Color.TRANSPARENT);
        y.setAxisLineWidth(0f);
        y.setValueFormatter(new MyYAxisValueFormatter());

        mChart.getAxisLeft().setEnabled(false);

        // add data
        getCoinDetails(coinTag);

//        setData(45, 100);
        mChart.getLegend().setEnabled(false);
        mChart.animateX(1500);

        // dont forget to refresh the drawing
//        mChart.invalidate();
    }
 
开发者ID:mayuroks,项目名称:Coin-Tracker,代码行数:73,代码来源:CoinDetailsActivity.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_coin_details);
        initToolbar("Coin Graph", 0);

        mChart = (LineChart) findViewById(R.id.chart);
        mChart.setBackgroundColor(Color.TRANSPARENT);

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

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

        // 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);

        mChart.setDrawGridBackground(false);
        mChart.setMaxHighlightDistance(300);

        XAxis x = mChart.getXAxis();
        x.setTextColor(Color.RED);
        x.setPosition(XAxis.XAxisPosition.BOTTOM);
        x.setAxisLineColor(Color.BLUE);
        x.setDrawGridLines(false);
        x.setAxisLineWidth(2f);

        YAxis y = mChart.getAxisRight();
//        y.setTypeface();
        y.setLabelCount(6, false);
        y.setTextColor(Color.RED);
        y.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
        y.setDrawGridLines(false);
        y.setAxisLineColor(Color.BLUE);
        y.setAxisLineWidth(2f);

        mChart.getAxisLeft().setEnabled(false);

        // add data
        setData(45, 100);
        mChart.getLegend().setEnabled(false);
        mChart.animateX(1000);

        // dont forget to refresh the drawing
        mChart.invalidate();

        // TODO Testing
        if (mChart.getData() != null) {
            mChart.getData().setHighlightEnabled(!mChart.getData().isHighlightEnabled());
            mChart.invalidate();
        }
    }
 
开发者ID:mayuroks,项目名称:Coin-Tracker,代码行数:60,代码来源:CubicLineChartActivity.java

示例15: initChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
private void initChart() {
    // init chart
    mChart.getDescription().setEnabled(false);
    mChart.setTouchEnabled(true);
    mChart.setDragDecelerationFrictionCoef(0.9f);
    mChart.setDragEnabled(true);
    mChart.setScaleEnabled(true);
    mChart.setDrawGridBackground(false);
    mChart.setHighlightPerDragEnabled(true);
    mChart.setBackground(getActivity().getDrawable(R.drawable.bg_chart));
    mChart.setViewPortOffsets(80f, 0f, 80f, 0f);
    setData();
    mChart.invalidate();
    mChart.getLegend().setEnabled(false);

    // init xAxis
    XAxis xAxis = mChart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM_INSIDE);
    xAxis.setDrawAxisLine(false);
    xAxis.setTextSize(10f);
    xAxis.setTextColor(Color.rgb(255, 192, 56));
    xAxis.setDrawGridLines(true);
    xAxis.setCenterAxisLabels(false);
    xAxis.setDrawGridLines(false);
    xAxis.setEnabled(false);
    xAxis.setGranularityEnabled(true);

    YAxis yAxis = mChart.getAxisLeft();
    yAxis.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
    yAxis.setTextColor(ColorTemplate.getHoloBlue());
    yAxis.setDrawGridLines(true);
    yAxis.setGranularityEnabled(true);
    yAxis.setAxisMinimum(50f);
    yAxis.setAxisMaximum(130f);
    yAxis.setYOffset(-9f);
    yAxis.setXOffset(-20f);
    yAxis.setTextColor(Color.rgb(255, 192, 56));
    yAxis.setDrawAxisLine(false);
    yAxis.setDrawGridLines(false);

    mChart.getAxisRight().setEnabled(false);
}
 
开发者ID:InnoFang,项目名称:FamilyBond,代码行数:43,代码来源:DataDisplayFragment.java


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