저는 xamarin.forms를 사용하고 있으며, 목록보기 내부에 그래프를 작성해야하며, microcharts를 사용하여 listview 내부에서 그래프를 작성하는 방법이 필요합니다. Xamarin을 사용한 목록보기의 마이크로 차트
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Vertical">
<!--<StackLayout.GestureRecognizers>
<TapGestureRecognizer
Tapped="TargetList_Tapped"/>
</StackLayout.GestureRecognizers>-->
<Grid
HeightRequest="10"/>
<customRenderer:CustomFrame HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" BackgroundColor="White" HeightRequest="30" Padding="15">
<StackLayout Orientation="Vertical" >
<!--<Image x:Name="sam"/>-->
<Label Text="{Binding AreaNo}"
TextColor="Black"
Font="Bold"/>
<StackLayout Margin="0, -5, 0, 0" Orientation="Horizontal">
<forms:ChartView x:Name="Chart1" HeightRequest="150"/>
<Label Text="Last Covered On:"
TextColor="Black"
Font="10"
FontAttributes="Bold"
Opacity="0.6"/>
<Label Text="{Binding DateCovered}"
TextColor="Black"
Font="10"
FontAttributes="Bold"
Opacity="0.6"/>
</StackLayout>
</StackLayout>
</customRenderer:CustomFrame>
<customRenderer:CustomFrame Padding="0" Margin="0, -10, 0, 0">
<Image x:Name="sampleImage" Source="Rectangle_Inactive.png" HorizontalOptions="FillAndExpand" Aspect="AspectFill"/>
</customRenderer:CustomFrame>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
이 xaml.cs 내 코드입니다 :
namespace PrismUnityApp6.Views
{
public partial class MainPage : ContentPage
{
List<Entry> entries = new List<Entry>
{
new Entry(200)
{
Color = SKColor.Parse("#008000"),
},
new Entry(400)
{
Color = SKColor.Parse("#FFFFFF")
}
};
public MainPage()
{
InitializeComponent();
Chart1.Chart = new RadialGaugeChart { Entries = entries };
}
}
}
이 코드를 시도했다가하지만 난 얻을 수
이 XAML에서 내 코드입니다 listview를 사용하는 동안 xaml.cs 파일의 차트 이름
모든 의견을 환영합니다. 고맙습니다.
바인딩을 사용하여 차트를 만드는 방법에 대한 리소스가 있습니까? 죄송합니다, 제 쿠마린 입문입니다. –
정확히 구현 하시겠습니까? 한 페이지에 하나 이상의 차트가 있어야합니까? –
이 차트를 사용합니다 .. https://blog.xamarin.com/microcharts-elegant-cross-platform-charts-for-any-app/ –