Skip to content

Commit 551dfce

Browse files
committed
Add C# binding for Chart.Area
1 parent b601e05 commit 551dfce

File tree

2 files changed

+99
-0
lines changed

2 files changed

+99
-0
lines changed

src/Plotly.NET.CSharp/ChartAPI/Chart2D.cs

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,100 @@ public static GenericChart.GenericChart Range<XType, YType, TextType>(
601601
UseDefaults: UseDefaults.ToOption()
602602
);
603603

604+
/// <summary> Creates an Area chart, which uses a Line plotted between the given datums in a 2D space, additionally colouring the area between the line and the Y Axis.</summary>
605+
/// <param name="x">Sets the x coordinates of the plotted data.</param>
606+
/// <param name="y">Sets the y coordinates of the plotted data.</param>
607+
/// <param name="ShowMarkers">Wether to show markers for the individual data points</param>
608+
/// <param name="Name">Sets the trace name. The trace name appear as the legend item and on hover</param>
609+
/// <param name="ShowLegend">Determines whether or not an item corresponding to this trace is shown in the legend.</param>
610+
/// <param name="Opacity">Sets the opactity of the trace</param>
611+
/// <param name="MultiOpacity">Sets the opactity of individual datum markers</param>
612+
/// <param name="Text">Sets a text associated with each datum</param>
613+
/// <param name="MultiText">Sets individual text for each datum</param>
614+
/// <param name="TextPosition">Sets the position of text associated with each datum</param>
615+
/// <param name="MultiTextPosition">Sets the position of text associated with individual datum</param>
616+
/// <param name="MarkerColor">Sets the color of the marker</param>
617+
/// <param name="MarkerColorScale">Sets the colorscale of the marker</param>
618+
/// <param name="MarkerOutline">Sets the outline of the marker</param>
619+
/// <param name="MarkerSymbol">Sets the marker symbol for each datum</param>
620+
/// <param name="MultiMarkerSymbol">Sets the marker symbol for each individual datum</param>
621+
/// <param name="Marker">Sets the marker (use this for more finegrained control than the other marker-associated arguments)</param>
622+
/// <param name="LineColor">Sets the color of the line</param>
623+
/// <param name="LineColorScale">Sets the colorscale of the line</param>
624+
/// <param name="LineWidth">Sets the width of the line</param>
625+
/// <param name="LineDash">sets the drawing style of the line</param>
626+
/// <param name="Line">Sets the line (use this for more finegrained control than the other line-associated arguments)</param>
627+
/// <param name="StackGroup">Set several traces (on the same subplot) to the same stackgroup in order to add their y values (or their x values if `Orientation` is Horizontal). Stacking also turns `fill` on by default and sets the default `mode` to "lines" irrespective of point count. ou can only stack on a numeric (linear or log) axis. Traces in a `stackgroup` will only fill to (or be filled to) other traces in the same group. With multiple `stackgroup`s or some traces stacked and some not, if fill-linked traces are not already consecutive, the later ones will be pushed down in the drawing order</param>
628+
/// <param name="Orientation">Sets the stacking direction. Only relevant when `stackgroup` is used, and only the first `orientation` found in the `stackgroup` will be used.</param>
629+
/// <param name="GroupNorm">Sets the normalization for the sum of this `stackgroup. Only relevant when `stackgroup` is used, and only the first `groupnorm` found in the `stackgroup` will be used</param>
630+
/// <param name="FillColor">ets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.</param>
631+
/// <param name="UseWebGL">If true, plotly.js will use the WebGL engine to render this chart. use this when you want to render many objects at once.</param>
632+
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
633+
public static GenericChart.GenericChart Area<XType, YType, TextType>(
634+
IEnumerable<XType> x,
635+
IEnumerable<YType> y,
636+
Optional<bool> ShowMarkers = default,
637+
Optional<string> Name = default,
638+
Optional<bool> ShowLegend = default,
639+
Optional<double> Opacity = default,
640+
Optional<IEnumerable<double>> MultiOpacity = default,
641+
Optional<TextType> Text = default,
642+
Optional<IEnumerable<TextType>> MultiText = default,
643+
Optional<StyleParam.TextPosition> TextPosition = default,
644+
Optional<IEnumerable<StyleParam.TextPosition>> MultiTextPosition = default,
645+
Optional<Color> MarkerColor = default,
646+
Optional<StyleParam.Colorscale> MarkerColorScale = default,
647+
Optional<Line> MarkerOutline = default,
648+
Optional<StyleParam.MarkerSymbol> MarkerSymbol = default,
649+
Optional<IEnumerable<StyleParam.MarkerSymbol>> MultiMarkerSymbol = default,
650+
Optional<Marker> Marker = default,
651+
Optional<Color> LineColor = default,
652+
Optional<StyleParam.Colorscale> LineColorScale = default,
653+
Optional<double> LineWidth = default,
654+
Optional<StyleParam.DrawingStyle> LineDash = default,
655+
Optional<Line> Line = default,
656+
Optional<string> StackGroup = default,
657+
Optional<StyleParam.Orientation> Orientation = default,
658+
Optional<StyleParam.GroupNorm> GroupNorm = default,
659+
Optional<Color> FillColor = default,
660+
Optional<bool> UseWebGL = default,
661+
Optional<bool> UseDefaults = default
662+
)
663+
where XType : IConvertible
664+
where YType : IConvertible
665+
where TextType : IConvertible
666+
=>
667+
Plotly.NET.Chart2D.Chart.Area<XType, YType, TextType>(
668+
x: x,
669+
y: y,
670+
ShowMarkers: ShowMarkers.ToOption(),
671+
Name: Name.ToOption(),
672+
ShowLegend: ShowLegend.ToOption(),
673+
Opacity: Opacity.ToOption(),
674+
MultiOpacity: MultiOpacity.ToOption(),
675+
Text: Text.ToOption(),
676+
MultiText: MultiText.ToOption(),
677+
TextPosition: TextPosition.ToOption(),
678+
MultiTextPosition: MultiTextPosition.ToOption(),
679+
MarkerColor: MarkerColor.ToOption(),
680+
MarkerColorScale: MarkerColorScale.ToOption(),
681+
MarkerOutline: MarkerOutline.ToOption(),
682+
MarkerSymbol: MarkerSymbol.ToOption(),
683+
MultiMarkerSymbol: MultiMarkerSymbol.ToOption(),
684+
Marker: Marker.ToOption(),
685+
LineColor: LineColor.ToOption(),
686+
LineColorScale: LineColorScale.ToOption(),
687+
LineWidth: LineWidth.ToOption(),
688+
LineDash: LineDash.ToOption(),
689+
Line: Line.ToOption(),
690+
StackGroup: StackGroup.ToOption(),
691+
Orientation: Orientation.ToOption(),
692+
GroupNorm: GroupNorm.ToOption(),
693+
FillColor: FillColor.ToOption(),
694+
UseWebGL: UseWebGL.ToOption(),
695+
UseDefaults: UseDefaults.ToOption()
696+
);
697+
604698
/// <summary>
605699
/// Creates a bar chart, with bars plotted horizontally
606700
///

tests/Plotly.NET.Tests.CSharpConsole/Program.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ static void Main(string[] args)
6767
lower: new int [] { 4, 2, 3 },
6868
mode: Mode.Lines,
6969
Name: "range"
70+
),
71+
Chart.Area<int,int,string>(
72+
x: new int [] { 1, 2},
73+
y: new int [] { 3, 1},
74+
Name: "area"
7075
)
7176
}
7277
).WithTraceInfo(

0 commit comments

Comments
 (0)