Skip to content

Commit a9f1c9c

Browse files
committed
Add C# binding for Chart.Contour
1 parent a36a205 commit a9f1c9c

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed

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

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,6 +2124,101 @@ public static GenericChart.GenericChart Image<IdType>(
21242124
UseDefaults: UseDefaults.ToOption()
21252125
);
21262126

2127+
/// <summary>
2128+
/// Creates a 2D contour plot, which shows the contour lines of a 2D numerical array z, i.e. interpolated lines of isovalues of z.
2129+
///
2130+
/// A contour line (also isoline, isopleth, or isarithm) of a function of two variables is a curve along which the function has a constant value, so that the curve joins points of equal value
2131+
///
2132+
/// The data from which contour lines are computed is set in `z`. Data in `z` must be a 2D array of numbers. Say that `z` has N rows and M columns, then by default, these N rows correspond to N y coordinates (set in `y` or auto-generated) and the M columns correspond to M x coordinates (set in `x` or auto-generated). By setting `transpose` to "true", the above behavior is flipped.
2133+
/// </summary>
2134+
/// <param name="zData">Sets the z data which is used for computing the contour lines.</param>
2135+
/// <param name="Name">Sets the trace name. The trace name appear as the legend item and on hover.</param>
2136+
/// <param name="ShowLegend">Determines whether or not an item corresponding to this trace is shown in the legend.</param>
2137+
/// <param name="Opacity">Sets the Opacity otf the trace.</param>
2138+
/// <param name="X">Sets the x coordinates.</param>
2139+
/// <param name="Y">Sets the y coordinates.</param>
2140+
/// <param name="Text">Sets a text associated with each datum</param>
2141+
/// <param name="MultiText">Sets individual text for each datum</param>
2142+
/// <param name="ColorBar">Sets the styles of the colorbar for this trace.</param>
2143+
/// <param name="ColorScale">Sets the colorscale for this trace.</param>
2144+
/// <param name="ShowScale">Wether or not to show the colorscale/colorbar</param>
2145+
/// <param name="ReverseScale">Reverses the color mapping if true. If true, `zmin` will correspond to the last color in the array and `zmax` will correspond to the first color.</param>
2146+
/// <param name="Transpose">Transposes the z data.</param>
2147+
/// <param name="ContourLineDash">Sets the contour line dash style</param>
2148+
/// <param name="ContourLineColor">Sets the contour line color</param>
2149+
/// <param name="ContourLineSmoothing">Sets the amount of smoothing for the contour lines, where "0" corresponds to no smoothing.</param>
2150+
/// <param name="ContourLine">Sets the contour lines (use this for more finegrained control than the other contourline-associated arguments).</param>
2151+
/// <param name="ContoursColoring">Determines the coloring method showing the contour values. If "fill", coloring is done evenly between each contour level If "heatmap", a heatmap gradient coloring is applied between each contour level. If "lines", coloring is done on the contour lines. If "none", no coloring is applied on this trace.</param>
2152+
/// <param name="ContoursOperation">Sets the constraint operation. "=" keeps regions equal to `value` "&lt;" and "&lt;=" keep regions less than `value` "&gt;" and "&gt;=" keep regions greater than `value` "[]", "()", "[)", and "(]" keep regions inside `value[0]` to `value[1]` "][", ")(", "](", ")[" keep regions outside `value[0]` to value[1]` Open vs. closed intervals make no difference to constraint display, but all versions are allowed for consistency with filter transforms.</param>
2153+
/// <param name="ContoursType">If `levels`, the data is represented as a contour plot with multiple levels displayed. If `constraint`, the data is represented as constraints with the invalid region shaded as specified by the `operation` and `value` parameters.</param>
2154+
/// <param name="ShowContourLabels">Determines whether to label the contour lines with their values.</param>
2155+
/// <param name="ContourLabelFont">Sets the font used for labeling the contour levels. The default color comes from the lines, if shown. The default family and size come from `layout.font`.</param>
2156+
/// <param name="Contours">Sets the styles of the contours (use this for more finegrained control than the other contour-associated arguments).</param>
2157+
/// <param name="FillColor">Sets the fill color if `contours.type` is "constraint". Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.</param>
2158+
/// <param name="NContours">Sets the maximum number of contour levels. The actual number of contours will be chosen automatically to be less than or equal to the value of `ncontours`. Has an effect only if `autocontour` is "true" or if `contours.size` is missing.</param>
2159+
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
2160+
public static GenericChart.GenericChart Contour<ZType, XType, YType, TextType>(
2161+
IEnumerable<IEnumerable<ZType>> zData,
2162+
Optional<string> Name = default,
2163+
Optional<bool> ShowLegend = default,
2164+
Optional<double> Opacity = default,
2165+
Optional<IEnumerable<XType>> X = default,
2166+
Optional<IEnumerable<YType>> Y = default,
2167+
Optional<TextType> Text = default,
2168+
Optional<IEnumerable<TextType>> MultiText = default,
2169+
Optional<ColorBar> ColorBar = default,
2170+
Optional<StyleParam.Colorscale> ColorScale = default,
2171+
Optional<bool> ShowScale = default,
2172+
Optional<bool> ReverseScale = default,
2173+
Optional<bool> Transpose = default,
2174+
Optional<Color> ContourLineColor = default,
2175+
Optional<StyleParam.DrawingStyle> ContourLineDash = default,
2176+
Optional<double> ContourLineSmoothing = default,
2177+
Optional<Line> ContourLine = default,
2178+
Optional<StyleParam.ContourColoring> ContoursColoring = default,
2179+
Optional<StyleParam.ConstraintOperation> ContoursOperation = default,
2180+
Optional<StyleParam.ContourType> ContoursType = default,
2181+
Optional<bool> ShowContourLabels = default,
2182+
Optional<Font> ContourLabelFont = default,
2183+
Optional<Contours> Contours = default,
2184+
Optional<Color> FillColor = default,
2185+
Optional<int> NContours = default,
2186+
Optional<bool> UseDefaults = default
2187+
)
2188+
where ZType : IConvertible
2189+
where XType : IConvertible
2190+
where YType : IConvertible
2191+
where TextType : IConvertible
2192+
=>
2193+
Plotly.NET.Chart2D.Chart.Contour<IEnumerable<ZType>, ZType, XType, YType, TextType>(
2194+
zData: zData,
2195+
Name: Name.ToOption(),
2196+
ShowLegend: ShowLegend.ToOption(),
2197+
Opacity: Opacity.ToOption(),
2198+
X: X.ToOption(),
2199+
Y: Y.ToOption(),
2200+
Text: Text.ToOption(),
2201+
MultiText: MultiText.ToOption(),
2202+
ColorBar: ColorBar.ToOption(),
2203+
ColorScale: ColorScale.ToOption(),
2204+
ShowScale: ShowScale.ToOption(),
2205+
ReverseScale: ReverseScale.ToOption(),
2206+
Transpose: Transpose.ToOption(),
2207+
ContourLineColor: ContourLineColor.ToOption(),
2208+
ContourLineDash: ContourLineDash.ToOption(),
2209+
ContourLineSmoothing: ContourLineSmoothing.ToOption(),
2210+
ContourLine: ContourLine.ToOption(),
2211+
ContoursColoring: ContoursColoring.ToOption(),
2212+
ContoursOperation: ContoursOperation.ToOption(),
2213+
ContoursType: ContoursType.ToOption(),
2214+
ShowContourLabels: ShowContourLabels.ToOption(),
2215+
ContourLabelFont: ContourLabelFont.ToOption(),
2216+
Contours: Contours.ToOption(),
2217+
FillColor: FillColor.ToOption(),
2218+
NContours: NContours.ToOption(),
2219+
UseDefaults: UseDefaults.ToOption()
2220+
);
2221+
21272222
/// <summary>
21282223
/// Creates a point density plot - a combination of a Scatter plot and Histogram2DContour.
21292224
///

0 commit comments

Comments
 (0)