Android图表库HelloChart绘制多折线图

本文档详细介绍了如何在Android应用中利用HelloChart库来绘制多条折线图。从展示效果图开始,接着说明了添加HelloChart库的依赖、配置布局文件以及在Activity类中实现绘图的步骤。
摘要由CSDN通过智能技术生成

一、效果图

这里写图片描述

二、实现步骤

1.添加依赖库

compile 'com.github.lecho:hellocharts-android:v1.5.8'

2.布局文件

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <include
        android:id="@+id/include_id"
        layout="@layout/titlelayout_theme"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:padding="4dp"
            android:orientation="horizontal">

            <View
                android:layout_width="6dp"
                android:layout_height="6dp"
                android:background="#BF0815" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="10sp"
                android:text="噪音"
                android:layout_marginLeft="5dp"
                android:textColor="@color/common_gray3"/>

        </LinearLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:padding="4dp"
            android:orientation="horizontal">

            <View
                android:layout_width="6dp"
                android:layout_height="6dp"
                android:background="#088B05" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="10sp"
                android:text="温度"
                android:layout_marginLeft="5dp"
                android:textColor="@color/common_gray3"/>

        </LinearLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:padding="4dp"
            android:orientation="horizontal">

            <View
                android:layout_width="6dp"
                android:layout_height="6dp"
                android:background="#0862D8" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="10sp"
                android:text="pm2.5"
                android:layout_marginLeft="5dp"
                android:textColor="@color/common_gray3"/>

        </LinearLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:padding="4dp"
            android:orientation="horizontal">

            <View
                android:layout_width="6dp"
                android:layout_height="6dp"
                android:background="#552705" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="10sp"
                android:text="风速"
                android:layout_marginLeft="5dp"
                android:textColor="@color/common_gray3"/>

        </LinearLayout>

        <
  • 1
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值