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


Java LineChart.setNoDataText方法代码示例

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


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

示例1: initInValidGoNoGoGameLineChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void initInValidGoNoGoGameLineChart(Activity activity, View view) {
    inValidGoNoGoGamesLineChart = (LineChart) view.findViewById(R.id.line_chart_invalid_gonogogames);
    inValidGoNoGoGamesLineChart.setDescription("");
    String noData = activity.getResources().getString(R.string.no_failures_to_display);
    inValidGoNoGoGamesLineChart.setNoDataText(noData);
    inValidGoNoGoGamesLineChart.setTouchEnabled(false);
    inValidGoNoGoGamesLineChart.setDragEnabled(true);
    inValidGoNoGoGamesLineChart.setScaleEnabled(true);
    inValidGoNoGoGamesLineChart.setPinchZoom(true);
    inValidGoNoGoGamesLineChart.setBackgroundColor(Color.WHITE);
    inValidGoNoGoGamesLineChart.setDrawGridBackground(false);

    YAxis leftAxis = inValidGoNoGoGamesLineChart.getAxisLeft();
    leftAxis.setAxisMinValue(0);

    YAxis righAxis = inValidGoNoGoGamesLineChart.getAxisRight();
    if (righAxis != null)
        righAxis.setEnabled(false);
}
 
开发者ID:lidox,项目名称:reaction-test,代码行数:20,代码来源:BarChartView.java

示例2: setupChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
/**
 * Setup chart (axis, grid, etc.).
 *
 * @param lineChart      chart to setup.
 * @param data           chart with the data.
 * @param firstTimestamp seconds timestamp of the first record (used as initial reference).
 */
private void setupChart(LineChart lineChart, LineData data, long firstTimestamp) {
    // General setup
    lineChart.setDrawGridBackground(false);
    lineChart.setDrawBorders(false);
    lineChart.setViewPortOffsets(50, 0, 50, 50);
    lineChart.getDescription().setEnabled(false);
    lineChart.getLegend().setEnabled(false);
    lineChart.setTouchEnabled(false);
    lineChart.setNoDataText(context.getString(R.string.no_flight_act_data_available));
    // X axis setup
    IAxisValueFormatter xAxisFormatter = new HourAxisValueFormatter(firstTimestamp);
    XAxis xAxis = lineChart.getXAxis();
    xAxis.setValueFormatter(xAxisFormatter);
    xAxis.setDrawGridLines(false);
    xAxis.setDrawAxisLine(false);
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setCenterAxisLabels(false);
    xAxis.setTextColor(ContextCompat.getColor(context, R.color.colorIcons));
    // Y axis setup
    YAxis yAxis = lineChart.getAxisLeft();
    yAxis.setAxisMaximum(40);
    yAxis.setAxisMinimum(0);
    yAxis.setDrawLabels(false);
    yAxis.setDrawAxisLine(false);
    yAxis.setDrawGridLines(true);
    lineChart.getAxisRight().setEnabled(false);
    // Add data
    lineChart.setData(data);
}
 
开发者ID:davidmigloz,项目名称:go-bees,代码行数:37,代码来源:RecordingsAdapter.java

示例3: ValueMarkerView

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
public ValueMarkerView(Context context, int layoutResource) {
    super(context, layoutResource);
    tvContent = (TextView) findViewById(R.id.tvContent);
    LineChart chart = (LineChart) findViewById(R.id.chart);
    chart.setNoDataText("");
    this.dateFormat = new SimpleDateFormat("dd.MM.yy HH:mm");
    this.date = new Date();
}
 
开发者ID:aislab-hevs,项目名称:magpie,代码行数:9,代码来源:ValueMarkerView.java

示例4: initChart

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

示例5: onCreate

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

示例6: onCreateView

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    view = inflater.inflate(R.layout.fragment_lastscanchart, container, false);

    LineChart cv_LastScan = (LineChart) view.findViewById(R.id.cv_LastScan);

    cv_LastScan.setOnChartGestureListener(new myChartGestureListener(cv_LastScan));

    XAxis xAxis = cv_LastScan.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setTextSize(10f);
    xAxis.setTextColor(getResources().getColor(R.color.colorGlucoseNow));
    xAxis.enableGridDashedLine(5f, 5f, 0f);
    xAxis.setDrawLimitLinesBehindData(true);

    YAxis yAxisLeft = cv_LastScan.getAxisLeft();
    YAxis yAxisRight = cv_LastScan.getAxisRight();

    yAxisRight.setEnabled(false);

    yAxisLeft.setTextSize(18f); // set the textsize
    yAxisLeft.setTextColor(getResources().getColor(R.color.colorGlucoseNow));
    yAxisLeft.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
    yAxisLeft.setStartAtZero(true);
    yAxisLeft.setYOffset(-6f);
    yAxisLeft.setAxisMinValue(0.0f);

    Legend legend = cv_LastScan.getLegend();
    legend.setEnabled(false);

    // no description text
    cv_LastScan.setDescription("");
    cv_LastScan.setNoDataText(getResources().getString(R.string.no_data));
    cv_LastScan.setNoDataTextDescription("");

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

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

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


    MyMarkerView mv = new MyMarkerView(view.getContext(), R.layout.custom_marker_view);

    // set the marker to the chart
    cv_LastScan.setMarkerView(mv);

    try {
        int sdk = android.os.Build.VERSION.SDK_INT;
        if (sdk < android.os.Build.VERSION_CODES.HONEYCOMB) {
            cv_LastScan.setHardwareAccelerationEnabled(false);

        } else {
           cv_LastScan.setHardwareAccelerationEnabled(true);
        }
    } catch (Exception e) {
    }

    refresh();

    return (view);
}
 
开发者ID:CMKlug,项目名称:Liapp,代码行数:70,代码来源:ChartFragment.java

示例7: initStatChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void initStatChart() {
    mChart = (LineChart) findViewById(R.id.chart1);

    mChart.setStartAtZero(true);

    // disable the drawing of values into the chart
    mChart.setDrawYValues(false);
    mChart.setDrawXLabels(false);
    mChart.setDrawBorder(false);
    mChart.setBorderPositions(new BarLineChartBase.BorderPosition[] {
            BarLineChartBase.BorderPosition.BOTTOM
    });

    // no description text
    mChart.setNoDataText(getResources().getString(R.string.no_game_data_title));
    mChart.setNoDataTextDescription(getResources().getString(R.string.no_game_data_title_desc));


    // enable value highlighting
    mChart.setHighlightEnabled(true);

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

    mChart.setDescription("");


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

    mChart.setPinchZoom(true);

    mChart.setHighlightIndicatorEnabled(false);

    mStatManager = new GameStatManager(getBaseContext());

    mChart.animateX(500);
    mChart.setBackgroundColor(Color.WHITE);
    mChart.setValueTextColor(mColor);
    mChart.setDrawLegend(false);

    mChart.setDrawVerticalGrid(false);
    mChart.setDrawGridBackground(false);
    mChart.setGridColor(Color.BLACK & 0x2FFFFFFF);
    mChart.setGridWidth(5f);

    mChart.setBorderColor(mColor);

    YLabels y = mChart.getYLabels();
    y.setTextColor(mColor);
    y.setLabelCount(4);
}
 
开发者ID:furkantektas,项目名称:braingames,代码行数:54,代码来源:StatActivity.java


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