gpt4 book ai didi

I want to highlight the series in-between the two touch points(我想突出两个接触点之间的系列)

转载 作者:bug小助手 更新时间:2023-10-24 17:54:31 30 4
gpt4 key购买 nike



I drawn a Line series using Syncfusion MAUI chart.
In this when I clicked on the series , It was considered as first click
Again I clicked , that was second click

我用SyncFusion毛伊图画了一个线列。在这个我点击这个系列的时候,它被认为是第一次点击,那就是第二次点击


I want to highlight series in between the two clicked points.

我想突出显示两个单击点之间的系列。


<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:ChartInteractionBehaviour"
xmlns:chart="clr-namespace:Syncfusion.Maui.Charts;assembly=Syncfusion.Maui.Charts"
x:Class="ChartInteractionBehaviour.MainPage">

<chart:SfCartesianChart>
<chart:SfCartesianChart.BindingContext>
<local:ViewModel></local:ViewModel>
</chart:SfCartesianChart.BindingContext>
<chart:SfCartesianChart.XAxes>
<chart:DateTimeAxis></chart:DateTimeAxis>
</chart:SfCartesianChart.XAxes>

<chart:SfCartesianChart.YAxes >
<chart:NumericalAxis ></chart:NumericalAxis>
</chart:SfCartesianChart.YAxes>

<chart:LineSeries ItemsSource="{Binding Data}"
XBindingPath="Date"
YBindingPath="Amount"
></chart:LineSeries>

<chart:SfCartesianChart.InteractiveBehavior>
<local:ChartInteractiveExt></local:ChartInteractiveExt>
</chart:SfCartesianChart.InteractiveBehavior>

</chart:SfCartesianChart>

</ContentPage>

using Syncfusion.Maui.Charts;
using System.Collections.ObjectModel;

namespace ChartInteractionBehaviour
{
public class ChartInteractiveExt : ChartInteractiveBehavior
{

private float firstClickX = float.NaN;
private float firstClickY = float.NaN;
private float secondClickX = float.NaN;
private float secondClickY = float.NaN;

protected override void OnTouchUp(ChartBase chart, float pointX, float pointY)
{
base.OnTouchUp(chart, pointX, pointY);

if (float.IsNaN(firstClickX) || float.IsNaN(firstClickY))
{
firstClickX = pointX;
firstClickY = pointY;
}
else if (float.IsNaN(secondClickX) || float.IsNaN(secondClickY))
{

secondClickX = pointX;
secondClickY = pointY;

if (chart is Syncfusion.Maui.Charts.SfCartesianChart cartesianChart)
{
var pointX1 = cartesianChart.PointToValue(cartesianChart.XAxes[0],firstClickX,firstClickY);
var pointY1 = cartesianChart.PointToValue(cartesianChart.YAxes[0], firstClickX, firstClickY);
var pointX2 = cartesianChart.PointToValue(cartesianChart.XAxes[0], secondClickX, secondClickY);
var pointY2 = cartesianChart.PointToValue(cartesianChart.YAxes[0], secondClickX, secondClickY);
}
}
}
}
}

Expected output (Example)

预期输出(示例)


Expected output (Example)


Please provide an idea or code to achieve this

请提供实现此目标的想法或代码


更多回答

help.syncfusion.com/maui/cartesian-charts/selection (You may also want to check out SelectionBehavior)

Help.syncfusion.com/maui/cartesian-charts/selection(您可能还想查看SelectionBehavior)

优秀答案推荐
更多回答

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com