Android开源 - SmallChart图表库

EmiKalb 8年前
   <p>SmallChart是一个开源的Android图表库,拥有5种不同的图表类型来展示数据。可以通过输入的数据以及可设置的颜色、画笔大小等属性方便的创建图表。</p>    <ul>     <li>Curve Chart(fill)</li>    </ul>    <p><a href="/misc/goto?guid=4959676510497411720"><img alt="curve" src="https://simg.open-open.com/show/fdf2f358f458f946071025dc38d187d3.png"></a></p>    <ul>     <li>bar Chart</li>    </ul>    <p><a href="/misc/goto?guid=4959676510592748303"><img alt="bar" src="https://simg.open-open.com/show/7634c3da7fbca8515f3ff7a3287e9f05.png"></a></p>    <ul>     <li>Line Chart</li>    </ul>    <p><a href="/misc/goto?guid=4959676510674830780"><img alt="line" src="https://simg.open-open.com/show/3a3da17d3297fd70518f04a838bb9725.png"></a></p>    <ul>     <li>Combine Chart</li>    </ul>    <p><a href="/misc/goto?guid=4959676510759449841"><img alt="combine" src="https://simg.open-open.com/show/2cd246c465b8fab54a71bec30409d9af.png"></a></p>    <ul>     <li>PieChart</li>    </ul>    <p><a href="/misc/goto?guid=4959676510852141026"><img alt="pie" src="https://simg.open-open.com/show/55900589e04ab1600322340bfd5a9b95.png"></a></p>    <ul>     <li>RadarChart</li>    </ul>    <p><a href="/misc/goto?guid=4959676510940222376"><img alt="radar" src="https://simg.open-open.com/show/3e48ced84e2a2487c83592034371b249.png"></a></p>    <h2>特征</h2>    <ul>     <li>折线图、曲线图(可填充)、柱状图、扇形图、雷达图,共5种图表类型。</li>     <li>组合图表类型,可任意组合折线图、曲线图、柱状图。</li>     <li>折线图、曲线图(可填充)、柱状图、扇形图都拥有绘制动画。</li>     <li>扇形图提供了触控交互效果。</li>    </ul>    <h2>使用</h2>    <h3>Gradle</h3>    <ul>     <li>Step 1. Add the JitPack repository to your build file</li>    </ul>    <pre>  <code class="language-java">    allprojects {          repositories {              ...              maven { url "https://jitpack.io" }          }      }  </code></pre>    <ul>     <li>Step 2. Add SmallChart</li>    </ul>    <pre>  <code class="language-java">    dependencies {              compile 'com.github.Idtk:SmallChart:v0.1.1'      }  </code></pre>    <h3>Maven</h3>    <ul>     <li>Step 1. Add the JitPack repository to your build file</li>    </ul>    <pre>  <code class="language-java">    <repositories>          <repository>              <id>jitpack.io</id>              <url>https://jitpack.io</url>          </repository>      </repositories>  </code></pre>    <ul>     <li>Step 2. Add SmallChart</li>    </ul>    <pre>  <code class="language-java">    <dependency>          <groupId>com.github.Idtk</groupId>          <artifactId>SmallChart</artifactId>          <version>v0.1.1</version>      </dependency>  </code></pre>    <p>以组合图表为例</p>    <h3>XML</h3>    <pre>  <code class="language-java"><com.idtk.smallchart.chart.CombineChart      android:id="@+id/combineChart"      android:layout_width="match_parent"      android:layout_height="match_parent"/></code></pre>    <h3>Java</h3>    <pre>  <code class="language-java">CombineChart combineChart = (CombineChart)view.findViewById(R.id.combineChart);  combineChart.isAnimated = false;  combineChart.setDataList(mDataList);</code></pre>    <h3>Data</h3>    <pre>  <code class="language-java">private CurveData mCurveData = new CurveData();  private ArrayList<PointF> mPointArrayList1 = new ArrayList<>();    private LineData mLineData = new LineData();  private ArrayList<PointF> mPointArrayList2 = new ArrayList<>();    private BarData mBarData = new BarData();  private ArrayList<PointF> mPointArrayList3 = new ArrayList<>();    private ArrayList<IBarLineCurveData> mDataList = new ArrayList<>();</code></pre>    <pre>  <code class="language-java">mBarData.setValue(mPointArrayList3);  mBarData.setColor(Color.CYAN);  mBarData.setPaintWidth(pxTodp(5));  mBarData.setTextSize(pxTodp(10));  mDataList.add(mBarData);    mLineData.setValue(mPointArrayList2);  mLineData.setColor(Color.MAGENTA);  mLineData.setPaintWidth(pxTodp(3));  mLineData.setTextSize(pxTodp(10));  mDataList.add(mLineData);    mCurveData.setValue(mPointArrayList1);  mCurveData.setColor(Color.YELLOW);  mCurveData.setPaintWidth(pxTodp(3));  mCurveData.setTextSize(pxTodp(10));  mDataList.add(mCurveData);</code></pre>    <p>其他图表示例请查看<a href="/misc/goto?guid=4959676511018471026">Example</a></p>    <p> </p>    <p>本站原创,转载时保留以下信息:<br> 本文转自:深度开源(open-open.com)<br> 原文地址:<a href="http://www.open-open.com/lib/view/open1470819423275.html">http://www.open-open.com/lib/view/open1470819423275.html</a></p>    <p> </p>