Nevron .NET Vision Documentation
Venn

Venn diagrams are illustrations that show the possible logical relationships between sets of objects. They are made up of two or more partially overlapping ellipses. The following figure displays a Venn diagram with 3 sets.




Figure 1.

Creating a Venn series

Venn series are represented by the NVennSeries type. An instance of this type must be added to the series collection of a Venn Chart (NVennChart object).

C#
Copy Code
// clear the Charts collection and create a new Venn chart
NVennChart chart = new NVennChart();
chartControl.Charts.Clear();
chartControl.Charts.Add(chart);

// add a Venn series to the chart
NVennSeries venn = (NVennSeries)chart.Series.Add(SeriesType.Venn);
Visual Basic
Copy Code
' clear the Charts collection and create a new Venn chart
Dim chart As New NVennChart
chartControl.Charts.Clear()
chartControl.Charts.Add(chart)

' add a Venn series to the chart
Dim venn As NVennSeries = chart.Series.Add(SeriesType.Venn)

Please note that currently Venn charts are supported only in 2D with the GDI+ render device.

Passing Data

Once the Venn series is created you have to add some shapes to it in order to create the actual diagram. You can add contours to the series with the help of the AddVennContour method. It accepts as parameters the contour shape, position and size, as well as an identification number for the contour. You have to supply an unique number for every Venn contour that you add. The following code creates a two set Venn by defining circles as Venn contours.

C#
Copy Code
venn.AddVennContour(VennShape.Ellipse, new NPointF(-15, 0), new NSizeF(50, 50), 0, 0);
venn.AddVennContour(VennShape.Ellipse, new NPointF(15, 0), new NSizeF(50, 50), 0, 1);
Visual Basic
Copy Code
venn.AddVennContour(VennShape.Ellipse, New NPointF(-15, 0), New NSizeF(50, 50), 0, 0)
venn.AddVennContour(VennShape.Ellipse, New NPointF(15, 0), New NSizeF(50, 50), 0, 1)

The two circular contours intersect and thus form three Venn segments. The labels for the Venn segments can be placed manually with the help of the AddLabel method. The following code adds three labels for the three segments:

C#
Copy Code
venn.AddLabel("A", new NPointF(-25, 0));
venn.AddLabel("B", new NPointF(0, 0));
venn.AddLabel("C", new NPointF(25, 0));
Visual Basic
Copy Code
venn.AddLabel("A", New NPointF(-25, 0))
venn.AddLabel("B", New NPointF(0, 0))
venn.AddLabel("C", New NPointF(25, 0))

In similar way you can specify Venn diagrams with more sets. The series accepts unlimited number of contours and labels. The following image displays a 5 set Venn diagram.



figure 2.

Controlling the Venn appearance

The segments fill styles are stored in the FillStyles collection. The fill style at a given index in this collection is applied to the segments that correspond to the index. For example the segments produced by zero intersections are filled with fill style 0, the segments produced by one intersection - with fill style 1, etc. This means that the number of fill styles in the FillStyles collection should be greater than or equal to the number of sets in the Venn diagram.

You can apply individual fill styles for specific segments with the help of the SetFillStyleForSegment method. It accepts an identifier of the segment and a fill style. The segment identifier is an array that contains the IDs of the contours that enclose the segment.

The borders styles are stored in the BorderStyles collection and are ordered similarly to the fill styles.

Venn interactivity
The default interactivity style for the Venn series is controlled through the InteractivityStyle property. You can assign individual interactivity styles to specific segments with the help of the SetInteractivityForSegment method. It accepts an identifier of the segment and an interactivity style. The segment identifier is an array that contains the IDs of the contours that enclose the segment.
Related Examples
Chart Gallery\Venn\Two Set Venn
Chart Gallery\Venn\Three Set Venn
Chart Gallery\Venn\Four Set Venn
Chart Gallery\Venn\Five Set Venn
See Also

 

 


©2017. Nevron Software LLC.

Send Feedback