我希望在我的应用程序中使用MPAndroid Chart.但是目前,指定点给出了具有锐边的线图.如何使图形的过渡平滑(例如类似于正弦波)?
谢谢 !
我想PieChart
在我的片段中显示一个.以下是我写的xml,
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background">
<LinearLayout
android:id="@+id/graphContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.github.mikephil.charting.charts.PieChart
android:id="@+id/piechart"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
问题是,PieChart
如果我给予match_parent
或,是不行的wrap_content
.如果我给出固定的高度和宽度它工作正常.此外,如果我删除它ScrollView
,它就像一个魅力!那么在什么情况下需要做ScrollView
什么?
我正在尝试使用MPAndroidChart在我的应用程序中创建一个图表.
但具有一些特定功能.
chart.getLayoutParams().width=100*entries.size();
最后,当触摸其中一个栏时,不选择下方的栏(如果有办法可以阻止用户滚动!).
MPAndroidChart在技术上是否可行?提前致谢.
我正在使用MPAndroidChart,我有两个问题:
我在的piechart
帮助下实现了mpandroid library
:
如您所见,一切正常...但是右侧的饼图图例有一个小问题。
页面的高度很小。图例未完全显示。
我的图例代码:
Legend l = mChart.getLegend();
l.setPosition(LegendPosition.RIGHT_OF_CHART);
l.setXEntrySpace(7);
l.setYEntrySpace(5);
setContentView(mChart);
Run Code Online (Sandbox Code Playgroud)
是否可以选择自动增加图表的高点以使图例完整显示或至少具有滚动功能?
提前Thx
斯特凡
我的应用程序显示折线图和自定义 MarkerView。MarkerView 的一个问题是阴影不起作用。相同的代码适用于活动的布局。但是,如果我将其复制到 MarkerView 的布局,则当我运行应用程序时,阴影不会显示。
为了显示阴影,我将高度设置为 5dp,并在视图上设置背景颜色。然后,对于其父视图,我将 padding 设置为 5dp,将 ClipToBounds 设置为 false。像下面这样:
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/line_chart_view"
app:layout_constraintBottom_toBottomOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:padding="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="some text"
android:elevation="10dp"
android:background="#FFFFFFFF"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建如下图表,对于我的Android应用程序使用MPAndroidChart.我无法弄清楚,如何使条形图的边缘呈圆形边缘.它始终是方形边缘.
所以,请你告诉我应该怎么做?
提前感谢您的帮助.
我所做的:我正在使用 MPAndroidChart ,我能够根据我的要求对其进行自定义,并尝试进一步的功能来删除描述标签,并增加字体和自定义图例。我所拥有的是现在;
<com.github.mikephil.charting.charts.PieChart
android:id="@+id/chart"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_gravity="center_horizontal"
>
</com.github.mikephil.charting.charts.PieChart>
Run Code Online (Sandbox Code Playgroud)
公共类 PFrag 扩展片段 {
float time[] = {55, 95, 30 , 360 - (55+95+30)};
String activity[] ={"Jan","Feb","March",""};
PieChart pieChart;
CircularProgressIndicator circularProgress;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.panorama_frag,container,false);
pieChart = view.findViewById(R.id.chart);
setupPieChart();
//circularProgress = view.findViewById(R.id.circular_progress);
// circularProgress.setMaxProgress(10000);
// circularProgress.setCurrentProgress(5000);
return view;
}
private void setupPieChart(){
//pupulating list of PieEntires
List<PieEntry> pieEntires = new ArrayList<>();
for( int i …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 MPAndroidChart(PieChart) 为我的 Android 应用程序创建如下所示的图表。我无法弄清楚如何使 Piechart 的边缘成为圆边。然后我看到 pieChart.setDrawRoundedSlices(true)
这行代码帮助我实现了下面的设计。现在添加此行后,饼图不再显示突出显示的切片。
GIT Hub 问题票: https://github.com/PhilJay/MPAndroidChart/issues/4804
带有突出显示切片的所需设计。
目前开发无法突出显示切片。
具有突出显示的切片且没有弯曲边缘的虚拟项目。