Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

VisualMelon
Copy link
Contributor

Fixes #1751 .

Checklist

  • I have included examples or tests
    -> want some interesting/compelling examples
  • I have updated the change log
  • I am listed in the CONTRIBUTORS file
  • I have cleaned up the commit history (use rebase and squash)

Changes proposed in this pull request:

  • Add a PolygonSeries and examples

@oxyplot/admins

@VisualMelon VisualMelon changed the title Add basic polygon series implementation Add PolygonSeries Aug 16, 2023
Comment on lines +94 to +120
// DataPoint cur = outline[0];
// DataPoint prev;
// for (int i = 1; i < outline.Length; i++)
// {
// prev = cur;
// cur = outline[i];

// if (cur.Equals(prev))
// {
// continue;
// }

// var y0 = Math.Min(cur.Y, prev.Y);
// var y1 = Math.Max(cur.Y, prev.Y);

// if (y0 > p.Y || y1 <= p.Y)
// continue;

// var c = (p.Y - prev.Y) / (cur.Y - prev.Y);
// var x = prev.Y + c * (cur.X - prev.Y);

// if (x <= p.X)
// intersectionCount++;
// }

// return intersectionCount % 2 == 0;
//}
Copy link
Contributor Author

@VisualMelon VisualMelon Aug 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea where this code came from or if it works for why it's commented out. Probably don't need it at all (tracker is done in screen space).

@VisualMelon
Copy link
Contributor Author

Outstanding questions:

  • Do we want polygons to have holes in them? If so, how do we want to represent this?
  • Should we have an outline tracker?

Outstanding problems:

  • ToCode crashes (so WPF example browser doesn't work; WinForms does)

@Jonarw
Copy link
Member

Jonarw commented Aug 16, 2023

Do we want polygons to have holes in them? If so, how do we want to represent this?

Our rendering API does not really support this I think... So this may be hard to implement even if we found a good way to represent this. So I would think we could do without for now.

Should we have an outline tracker?

An outline tracker (that could be enabled as an option) could be nice-to-have, but I wouldn't consider it a must from the start.

@SADASHIMA
Copy link

SADASHIMA commented Sep 25, 2024

Here are my impressions after trying it out.

  • If the axis was not a LinearColorAxis, an error occurred.
System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=OxyPlot
  スタック トレース:
   場所 OxyPlot.Axes.ColorAxisExtensions.GetColor(IColorAxis axis, Double value) (.\oxyplot-polygonseries\Source\OxyPlot\Axes\ColorAxisExtensions.cs):行 25
  • I wanted to use it in the same way as AreaSeries, setting a single color with Fill.
  • Example.WPF PlygonSeries example did not display correctly in my environment
System.FormatException
  HResult=0x80131537
  Message=インデックス (0 ベース) は 0 以上で、引数リストのサイズよりも小さくなければなりません。
  Source=mscorlib
  スタック トレース:
   場所 System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
   場所 System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
   場所 System.String.Format(String format, Object[] args)
   場所 OxyPlot.CodeGenerator.FormatCode(String format, Object[] values) (.\oxyplot-polygonseries\Source\OxyPlot\Foundation\CodeGenerator\CodeGenerator.cs):行 110
   場所 OxyPlot.CodeGenerator.FormatConstructor(Type type, String format, Object[] values) (.\oxyplot-polygonseries\Source\OxyPlot\Foundation\CodeGenerator\CodeGenerator.cs):行 122
   場所 OxyPlot.Series.PolygonItem.ToCode() (.\oxyplot-polygonseries\Source\OxyPlot\Series\PolygonItem.cs):行 130
   場所 OxyPlot.CodeGeneratorStringExtensions.ToCode(Object value) (.\oxyplot-polygonseries\Source\OxyPlot\Foundation\CodeGenerator\CodeGeneratorStringExtensions.cs):行 156
   場所 OxyPlot.CodeGenerator.AddItems(String name, IList list) (.\oxyplot-polygonseries\Source\OxyPlot\Foundation\CodeGenerator\CodeGenerator.cs):行 182
   場所 OxyPlot.CodeGenerator.SetProperties(Object instance, String varName, Object defaultValues) (.\oxyplot-polygonseries\Source\OxyPlot\Foundation\CodeGenerator\CodeGenerator.cs):行 406
   場所 OxyPlot.CodeGenerator.Add(Object obj) (.\oxyplot-polygonseries\Source\OxyPlot\Foundation\CodeGenerator\CodeGenerator.cs):行 154
   場所 OxyPlot.CodeGenerator.AddChildren(String name, String collectionName, IEnumerable children) (.\oxyplot-polygonseries\Source\OxyPlot\Foundation\CodeGenerator\CodeGenerator.cs):行 168
   場所 OxyPlot.CodeGenerator..ctor(PlotModel model) (.\oxyplot-polygonseries\Source\OxyPlot\Foundation\CodeGenerator\CodeGenerator.cs):行 71
   場所 OxyPlot.PlotModel.ToCode() (.\oxyplot-polygonseries\Source\OxyPlot\PlotModel\PlotModel.cs):行 722
   場所 ExampleLibrary.ExampleInfo.GetCode(ExampleFlags flags) (.\oxyplot-polygonseries\Source\Examples\ExampleLibrary\ExampleInfo.cs):行 112
   場所 ExampleBrowser.MainWindowViewModel.UpdatePlotModel() (.\oxyplot-polygonseries\Source\Examples\WPF\ExampleBrowser\MainWindowViewModel.cs):行 161
   場所 ExampleBrowser.MainWindowViewModel.CoerceSelectedExample() (.\oxyplot-polygonseries\Source\Examples\WPF\ExampleBrowser\MainWindowViewModel.cs):行 151
   場所 ExampleBrowser.MainWindowViewModel.set_SelectedExample(ExampleInfo value) (.\oxyplot-polygonseries\Source\Examples\WPF\ExampleBrowser\MainWindowViewModel.cs):行 111

@VisualMelon
Copy link
Contributor Author

Thanks for the feedback: working without a color axis is clearly an overlooked use case.

sadashima and others added 4 commits September 27, 2024 16:04
Fixed an issue where PolygonSeries was not displayed correctly in ExampleBrowser.
Fixes for errors from the IDE
Add SADASHIMA as a contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Polygon Series
3 participants