Diagramming for WinForms 6.0.4

MindFusion has released a new version of its popular diagramming component for WinForms. Most of the new features are requested by the users – here is a list:

Import of OpenOffice Draw Files

The new DrawImporter class can import *.odg files, created by the OpenOffice Draw vector graphics editor. The importer requires a reference to the MindFusion.Diagramming.Import.Draw.dll assembly. The DrawImporter supports shapes from the General and Flowchart shape palettes in Draw. At your disposal are a variety of Import method overloads that can be used to import the OpenOffice drawing into a DiagramDocument whose pages correspond to the Draw pages, or into a single Diagram whose content is merged from all imported pages.

Import from OpenOffice Draw files is now supported.

Import from OpenOffice Draw files is now supported.

Miscellaneous

Rotation of a node.

Rotation of a node.

A trial version of the component is available from this link:

Diagramming for WinForms 6.0.4

If you have questions or run into problems using the component you can use the Diagramming for WinForms forum, the help desk or write us at support@mindfusion.eu. Our support team will be pleased to help you.

About MindFusion.Diagramming for WinForms: A programming component that provides any WinForms application with a full set of features for creating and customizing all types of diagrams, flowcharts, schemes, hierarchies, trees, graphs etc. The control provides numerous ways to save and load a diagram, six auxiliary controls and more than 10 automatic graph layout algorithms. Diagram elements include scrollable tables, container nodes, multi-segment arrows, custom diagram item types and many more. Further details here.

Diagramming for WinForms is a royalty-free component, clients get 12 month upgrade subscription when buying a license. The source code is also available for purchase. Visit the buy page for a list with the current license prices.

Charting for WinForms 3.5

MindFusion has released a new version of its charting component for WinForms. Here is an overview of the new features:

Mouse Dragging in Pies
You can click on the border between any two pieces in a pie chart and drag it to change the values of those pieces. The sum of the values for the two pieces stays the same.

Support for Undefined Values
If your data contains null, double.NaN or other data that is not defined you have three ways to handle it – ignore it, replace it with 0 or with the average of the two neighbouring values. Use the HandleEmptyValue property to choose how undefined values are handled.

ToolTips
All chart types support tool tips. Area charts can show a different tooltip for the region between each two values.

Tool tips in a 3D cylinder chart.

Tool tips in a 3D cylinder chart.

Themes
Chart themes are represented by XML files that can be saved and loaded with the SaveTheme and LoadTheme methods. At your disposal is a special theme editor tool that helps you create, edit and save themes fast and easy.

Major and Minor Axis Ticks
Axis ticks are drawn more precisely now – you can draw major and minor ticks. The count of minor ticks is customizable. You can set the pen and length of both ticks. Ticks are supported for all chart axes.

Miscellaneous
Hit testing has been greatly improved. All chart types support the DataIndex and SeriesIndex properties, which let you know the exact location of the hittMindFusion has released a new version of its charting component for WinForms. Here is an overview of the new features:

Mouse Dragging in Pies
You can click on the border between any two pieces in a pie chart and drag it to change the values of those pieces. The sum of the two piece values stays the same.

Support for Undefined Values
If your data contains null, double.NaN or other data that is not defined you have three ways to handle it – ignore it, replace it with 0 or with the average of the two neighbouring values. Use the HandleEmptyValue property to choose how undefined values are handled.

ToolTips
All chart types support tool tips. Area charts can show a different tooltip for the region between each two values.

Themes
Chart themes are represented by XML files that can be saved and loaded with the SaveTheme and LoadTheme methods. At your disposal is a special theme editor tool that helps you create, edit and save themes fast and easy.

Major and Minor Axis Ticks
Axis ticks are drawn more precisely now – you can draw major and minor ticks. The count of minor ticks is customizable. You can set the pen and length of both ticks. Ticks are supported for all chart axes.

Major and minor axis ticks in a scatter chart.

Major and minor axis ticks in a scatter chart.

Miscellaneous
Hit testing has been greatly improved. All chart types support the DataIndex and SeriesIndex properties, which let you know the exact location of the hi value in the arrays with data values for the chart. There are also other new and improved features regarding the hit testing of a chart.

Some changes were necessary to keep the API simple and elegant – we have renamed several existing properties – please check the documentation.

Read more about the new features at the Charting for WinForms forum.

The trial version is available for direct download from this link:

Download MindFusion.Charting for WinForms 3.5

Technical support is available at the forum, help desk or at e-mail support@mindfusion.eu. All inquiries are answered within hours of being received.

About MindFusion.Charting for WinForms: a professional programming component for WinForms, which lets you create remarkable charts fast and easy. The tool supports all major chart types – line, pie, radar and bar – and numerous variations of them – column, area, bubble, polar, doughnut etc. 3D charts are supported as well.

Charting for WinForms supports a rich user interaction model with features like zoom, hit testing, drill down, mouse dragging and more. You can use delegates to present mathematical functions, undefined values are also acceptable. Values can be data arrays or retrieved through a database.

The appearance of each chart is fully customizable. The control offers strong design-time support with custom collection editors and chart wizards. At your disposal is a set of predefined appearance themes and a theme editor tool. A full list of the features can be read here.

Line Chart with a Separator in WinForms

In today’s post we’ll show how to build a line chart with several line series and a separator line. The separator line is drawn at a given height and divides the chart into two halves.

The Line Series

The line series are three, so we must add three lists with data to the XData and YData properties. We can do this in three ways: type the values in design time, write them in code or use data binding. In design time we use the built-in collection editors of the control:

The Series collection editor

The Series collection editor

In code we make lists with the data and add them to XData or YData:

lineChart1.YData.Clear();
lineChart1.YData.Add(new List { 45, 64, 38.2, 33.03, 56, 68, 39, 42 });
lineChart1.YData.Add(new List { 34, 42, 28, 42, 35, 31, 62, 55 });
lineChart1.YData.Add(new List { 22, 19, 32, 28, 17, 25, 31, 36 });

If you want to use data binding then set DataSource to the name of the data source, DataMember to specify the name of the table which will supply the data and XDataFields/YDataFields to provide the name(s) of the fields. In this case we will require three data base columns for each of the three series – separate the names with a comma e.g.

lineChart1.YDataFields = "Sales1,Sales2,Sales3";

For XData we use the same list because we want the series to appear exactly under each other:

lineChart1.XData.Clear();
lineChart1.XData.Add(new List { 10, 20, 30, 40, 50, 60, 70, 80 });
lineChart1.XData.Add(new List { 10, 20, 30, 40, 50, 60, 70, 80 });
lineChart1.XData.Add(new List { 10, 20, 30, 40, 50, 60, 70, 80 });

The Series

We set LineType to Line and Scatter because we want to show scatters at data points:

lineChart1.LineType = MindFusion.Charting.LineTypes.Line |  
MindFusion.Charting.LineTypes.Scatter;

The LineTypes enumeration allows bit wise combining of its members. We use ChartPens to set the pens for the line series. ShapesPens and ShapeBrushes set the pens for the outline and the brushes for filling the scatters:

lineChart1.ChartPens.Add(new MindFusion.Drawing.Pen(Color.FromArgb(102, 205, 170), 6));
lineChart1.ShapePens.Add(new MindFusion.Drawing.Pen(Color.FromArgb(102, 205, 170), 2));   

The pens for the series are thicker than the pens for the scatters. The fill brush is slightly lighter:

lineChart1.ShapeBrushes.Add(new MindFusion.Drawing.SolidBrush(Color.FromArgb(175, 251, 175)));

Finally – we set the size of the shapes and their type:

lineChart1.Shapes.Add(MindFusion.Charting.Shape.Circle);
lineChart1.ShapeSizes.Add(10);

The Separator

There are two ways to draw the separator line.

The first is to add a custom summary value. In this case the separator line will be drawn from the
smallest X-data value to the biggest one, parallel to the axes.

lineChart1.AddCustomSummary(40.0, "");

The summary line is drawn with shapes at both ends, but we can hide them by setting their size to 0:

lineChart1.SummaryBrushes.Add(new MindFusion.Drawing.SolidBrush(Color.Gray));
lineChart1.SummaryShapeSizes.Add(0);

The second way to draw the separator line is to add it as a 4th series in the XData and YData lists and add a pen for it in the ChartPens list. The advantage is that we can make the line as long as we want, in our case – as long as the length of the X-axis:

lineChart1.XData.Add(new List { 0, 90 });

The Legend

We use LegendLabels to add the labels for the line series:

lineChart1.LegendLabels = new List() { "2010", "2011", "2012" };

We set the background of the legend, but we don’t have to add any brushes or shapes for the legend items – they are taken automatically from the line series settings:

lineChart1.LegendBackgroundBrush = new MindFusion.Drawing.SolidBrush(Color.FromArgb(253, 253,  
253));


The Grid

The GridType is GridType.HorScale. We use GridBrush, AltGridBrush and GridPen to set the colors for the grid.

lineChart1.GridPen = new MindFusion.Drawing.Pen(Color.FromArgb(200, 200, 200));
lineChart1.GridPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
lineChart1.GridType = MindFusion.Charting.GridType.HorScale;

If you make the changes to the chart in code, don’t forget to call UpdateChart() to make sure the
control knows changes have happened and the chart must be updated.

Here is the final chart:

A line chart with a separator line.

A line chart with a separator line.

The sample is available for download from here:

Download Line Chart with Separator Line Sample

You can download the trial version of the component with extensive documentation and many other samples from here:

Download MindFusion.Charting for WinForms Trial Version

Diagramming for WinForms V.6.0.3

MindFusion has just released a new version of its popular Diagramming component for WinForms. The new features are mostly requested by the users. Here is a list:

ContainerNode Improvements

  • Each container now draws its child nodes. When containers overlap, the children of the lower container can’t appear above the children of the upper container any more.
  • The ClipChildren property indicates whether to clip child items to container’s boundaries
  • The ZIndex property no longer changes automatically when dropping nodes into a container
  • and more
Container nodes

Container nodes

PdfExporter Improvements

  • Clip regions are handled better in custom drawing code
  • PDF shadings now include all colors from a ColorBlend
  • More precise character width when text includes both eastern glyphs and Latin characters.
  • and more.

New events

  • The SetSelfLoopShape event is raised when a link becomes a self-loop, giving you a chance to set a custom shape for the link.
  • The QueryAlignTarget event is raised to determine if a node should be used as alignment guide target when AutoAlignNodes is enabled.
Differently formatted text.

Differently formatted text.

As well other new properties, methods and features – you can read the full list here.

A trial version of the component is available from this link:

Diagramming for WinForms 6.0.3

If you have questions or run into problems using the component you can use the Diagramming for WinForms forum, the help desk or write us at support@mindfusion.eu. Our support team will be pleased to help you.

About MindFusion.Diagramming for WinForms: A programming component that provides any WinForms application with a full set of features for creating and customizing all types of diagrams, flowcharts, schemes, hierarchies, trees, graphs etc. The control provides numerous ways to save and load a diagram, six auxiliary controls and more than 10 automatic graph layout algorithms. Diagram elements include scrollable tables, container nodes, multi-segment arrows, custom diagram item types and many more. Further details here.

Diagramming for WinForms is a royalty-free component, clients get 12 month upgrade subscription when buying a license. The source code is also available for purchase. Visit the buy page for a list with the current license prices.

Working Hours Bar Chart in WinForms

In this post we will explore how to create a bar chart that shows the weekly working hours for each
member of a team. We use MindFusion.Charting for WinForms component.

The Type of the Bar Chart

We decide to use a horizontal bar chart, which will give a clear visual representation of the data in this case. We use the BarType property to choose the bar type and set the Horizontal property:

barChart1.Horizontal = true;
barChart1.BarType = MindFusion.Charting.BarType.Single3D;

A 3D chart would look more sophisticated so we choose “Single3D” for a BarType.

The Data

We don’t need to set data for both axes – one is enough. The control automatically sets values for the
other axis to make the bars equally distributed. We can write the data by hand or use the built-in
design time collection editor:


barChart1.Data.Add(new List() { 82, 60, 73, 45, 19, 34, 58, 23, 69, 17 });

The data collection editor

The data collection editor

The Axes

The X-axis shows a scale of the total working hours for the week. We set its LabelType to “AutoScale
and set the interval to 10:

barChart1.XAxisSettings.LabelType = MindFusion.Charting.AxisLabelType.AutoScale;
barChart1.XAxisSettings.AxisDelta = 10;

This is the only axis that shows numbers on the chart, so we show the starting zero number:

barChart1.XAxisSettings.DrawZero = true;

We want to show whole numbers at the axis – no decimal fractions – and we use the NumberFormat property to set this:

barChart1.XAxisSettings.NumberFormat = MindFusion.Charting.NumberFormat.Fixed_point_0Digits;

Finally, we set the title:

barChart1.XAxisSettings.TitleLabel = "Total Weekly Hours";

For the Y-axis we want to show custom labels – the name of each employee. We use the YLabels property to specify the labels and set YAxisSettings.LabelType to the appropriate value:

barChart1.YAxisSettings.LabelType = MindFusion.Charting.AxisLabelType.CustomText;
barChart1.YLabels.Add(new List() { "Mary Johnson", "Tim Davidson", "Alan Hank", "Elisa Labate", "Boris Foster", "Tim Carnes", "Olivia Beverling", "Mark Buchanan", "Ron Callary", "Cindy Peterson" });

The Grid

A vertical grid will help us identify the value of each bar. The GridType property, together with the
GridBrush and AltGridBrush help use set the type and colors of the grid. We outline the plot area with PlotAreaOutline:

GridType = MindFusion.Charting.GridType.VertScale;
barChart1.GridBrush = new MindFusion.Drawing.SolidBrush(Color.White);
barChart1.AltGridBrush = new MindFusion.Drawing.SolidBrush(Color.FromArgb(240, 240, 240));
PlotAreaOutlinePen = new MindFusion.Drawing.Pen(Color.FromArgb(220, 220, 220));

The Bar Colors

We use ChartBrushes and ChartPens to specify how our bars will be colored. Here is the final chart:

3D BarChart in .NET WinForms

3D BarChart in .NET WinForms

Scrolling the chart:

We set the ResizeType to “Scrollable“. This way we can scroll to see all data on the chart without the need to increase the size of the chart and let it take too much space.

barChart1.ResizeType = MindFusion.Charting.WinForms.ResizeType.Scrollable;

The sample is available for download from here:

Download WinForms Working Hours Bar Chart Sample

A trial version of MindFusion.Charting for WinForms is available from here:

Download MindFusion.Charting for WinForms