Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 散点序列中单个点的填充颜色_C#_Xamarin_Xamarin.forms_Oxyplot - Fatal编程技术网

C# 散点序列中单个点的填充颜色

C# 散点序列中单个点的填充颜色,c#,xamarin,xamarin.forms,oxyplot,C#,Xamarin,Xamarin.forms,Oxyplot,因此,我尝试使用Xamarin.Forms下的OxyPlot创建一个ScatterSeries,我希望在用户与它交互时填充一个点 情节本身被渲染得恰到好处,而互动似乎也是如此 问题是,单击某个点后,首先不会使用PlotModel的SelectionColor填充该点。我必须拖动画布以使其更新,然后更新特定点并填充SelectionColor 我实例化了PlotModel,如下所示: var model = new PlotModel() { SelectionColor = OxyC

因此,我尝试使用Xamarin.Forms下的OxyPlot创建一个
ScatterSeries
,我希望在用户与它交互时填充一个点

情节本身被渲染得恰到好处,而互动似乎也是如此

问题是,单击某个点后,首先不会使用
PlotModel
SelectionColor
填充该点。我必须拖动画布以使其更新,然后更新特定点并填充
SelectionColor

我实例化了
PlotModel
,如下所示:

var model = new PlotModel()
{  
    SelectionColor = OxyColors.Red,
    // ...
};
此后,我将实例化my
ScatterSeries

var scatterSeries = new ScatterSeries()
{
    SelectionMode = SelectionMode.Single,
    // ...
};
scatterSeries.TouchStarted += (sender, e) =>
{
    var xCoordinate = e.Position.X;
    var yCoordinate = e.Position.Y;

    var screenPoint = new ScreenPoint(xCoordinate, yCoordinate);

    var point = lineSeries.GetNearestPoint(screenPoint, false);
    var index = (int)point.Index;
    scatterSeries.SelectItem(index);

    // I expect it to refresh and update the PlotModel here:
    model.InvalidatePlot(true); 

    e.Handled = true;
};
接下来,我创建一个
散点列表

var scatterPoints = new List<ScatterPoint>
{
    new ScatterPoint(0, 4),
    // ...
};
如前所述,这似乎工作正常,除了
绘图模型
没有立即使用
选择颜色更新之外-我必须在画布更新之前拖动它

有什么想法吗?

现在我有了。等待答复。