LineChart中No chart data available的自定义

LineChart mLineChart = (LineChart) rootView.findViewById(R.id.lineChart);
if(recordDataList.size()!=0){
     //当数据不为空的时候
    for(int i=0;i<recordDataList.size();i++){
        mList.add(recordDataList.get(i).getGrowDate().substring(recordDataList.get(i).getGrowDate().length()-5));
    }
}else {
    //当数据为空的时候提醒用户
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            mLineChart.setNoDataText("您暂无数据,请添加数据...");
            mLineChart.setNoDataTextColor(Color.BLACK);
            mLineChart.invalidate();
        }
    },100);
    return;
}
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Add advanced charting to your ASP.NET applications. Dundas Chart ASP.NET Enterprise Edition is a fully managed, CLR (Common Language Runtime) compliant charting component designed for ASP.NET development. Included is support for all standard and many advanced chart types, drilldown functionality, full Visual Studio Integrated help, a variety of different image formats and intuitive samples and examples to speed up development time. Graphics take full advantage of GDI+ and the use of transparency, anti-aliasing, gradients and more. Dundas Chart for ASP.NET Enterprise Edition includes many advanced features including: formula support, data grouping, data filtering and advanced chart types. Dundas Chart for .NET is the industry leader in .NET Charting Solutions. Providing you with the most comprehensive features, the most complete sample framework, and the best live technical support available. From start to finish, our team is dedicated to providing what you need to make your project successful. Whether you are implementing charting into internal projects, or building applications for clients, Dundas Chart offers advanced, award-winning technology and advanced results to get the most out of data What’s new in Dundas Chart for ASP.NET? Now supports Visual Studio 2010 What’s new in Dundas Chart V7.1? - V7.1 fixes these issues: AlwaysRecreateHotregions="True" in WinForms templates or templates generated by Chart Builder causes the Exception Can't deserialize property. Unknown property name "AlwaysRecreateHotregions" in object Dundas.Charting.WebControl.Chart" when de-serialized in ASP.NET Chart. This property only exists in the WinForms Chart. The ASP.NET Chart ignores this property by default now. Chart .NET: Stacked Column + 3D throws an Index was out of range exception when series have a different number of data points The accumulation distribution formula is incorrect; if open and close are the same it will divide by zero. A friendlier exception message is th
在Android使用LineChart可以通过使用MPAndroidChart库来实现。MPAndroidChart是一个功能强大的图表库,可以方便地创建各种类型的图表,包括线图、柱状图、饼图等。 首先,需要在项目的build.gradle文件添加MPAndroidChart库的依赖: ``` dependencies { implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' } ``` 然后,在布局文件添加LineChart控件: ``` <com.github.mikephil.charting.charts.LineChart android:id="@+id/line_chart" android:layout_width="match_parent" android:layout_height="match_parent" /> ``` 接下来,在代码获取LineChart控件的实例,并对其进行配置和数据的设置: ``` LineChart lineChart = findViewById(R.id.line_chart); // 设置线图的描述 lineChart.getDescription().setEnabled(false); // 设置线图的缩放 lineChart.setTouchEnabled(true); lineChart.setDragEnabled(true); lineChart.setScaleEnabled(true); lineChart.setPinchZoom(true); // 创建一条数据集并添加数据 List<Entry> entries = new ArrayList<>(); entries.add(new Entry(0, 10)); entries.add(new Entry(1, 20)); entries.add(new Entry(2, 30)); entries.add(new Entry(3, 40)); entries.add(new Entry(4, 50)); LineDataSet dataSet = new LineDataSet(entries, "Label"); dataSet.setColor(Color.RED); dataSet.setValueTextColor(Color.BLUE); // 创建一个数据集的数组并将其设置到线图上 List<ILineDataSet> dataSets = new ArrayList<>(); dataSets.add(dataSet); LineData data = new LineData(dataSets); lineChart.setData(data); // 刷新线图 lineChart.invalidate(); ``` 以上代码实现了一个简单的线图,并将其添加到了LineChart控件上。可以通过修改数据集的值,来实现动态更新线图的效果。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值