private static void RenderSeriesLabel(ChartGraphics graph, TreeMapNode seriesTreeMapNode, RectangleF labelRelativeRect) { if (!labelRelativeRect.IsEmpty) { Series series = seriesTreeMapNode.Series; DataPoint dataPoint = seriesTreeMapNode.DataPoint; using (Font font = TreeMapChart.GetSeriesLabelFont(dataPoint)) { StringFormat stringFormat = new StringFormat(); stringFormat.Alignment = StringAlignment.Near; stringFormat.LineAlignment = StringAlignment.Near; graph.DrawStringRel(series.legendText, font, new SolidBrush(dataPoint.FontColor), labelRelativeRect.Location, stringFormat, 0); } } }
public static void CalculateRectangles(RectangleF containerRect, IEnumerable <TreeMapNode> treeMapNodes, double value) { TreeMapSquaringAlgorithm treeMapSquaringAlgorithm = new TreeMapSquaringAlgorithm(); IEnumerable <TreeMapDataPointInfo> enumerable = treeMapSquaringAlgorithm.Split(containerRect, value, treeMapNodes); foreach (TreeMapDataPointInfo item in enumerable) { RectangleF rect = item.Rect; TreeMapNode node = item.Node; node.Rectangle = rect; if (node.Children != null) { TreeMapSquaringAlgorithm.CalculateRectangles(node.Rectangle, node.Children, node.Value); } } }
private static void BuildTreeNodes(CommonElements common, ChartArea area, out double chartTotal, out List <TreeMapNode> seriesTreeMapNodes) { chartTotal = 0.0; seriesTreeMapNodes = new List <TreeMapNode>(); foreach (Series item in common.DataManager.Series) { if (item.IsVisible() && !(item.ChartArea != area.Name)) { double num = 0.0; List <TreeMapNode> list = new List <TreeMapNode>(); foreach (DataPoint point in item.Points) { TreeMapNode treeMapNode = new TreeMapNode(point); list.Add(treeMapNode); num += treeMapNode.Value; } TreeMapNode treeMapNode2 = new TreeMapNode(item, num); treeMapNode2.Children = list; seriesTreeMapNodes.Add(treeMapNode2); chartTotal += treeMapNode2.Value; } } }
public TreeMapDataPointInfo(RectangleF rect, TreeMapNode dataPoint) { this.Rect = rect; this.Node = dataPoint; }
private static RectangleF GetDataPointLabelRelativeRect(ChartGraphics graph, TreeMapNode dataPointTreeMapNode, RectangleF dataPointRelativeRect, string text) { DataPoint dataPoint = dataPointTreeMapNode.DataPoint; return(TreeMapChart.GetLabelRelativeRect(graph, dataPoint.Font, dataPointRelativeRect, text, TreeMapChart.GetLabelAlignment(dataPoint))); }
private static RectangleF GetRelativeRect(ChartGraphics graph, TreeMapNode treeMapNode) { return(graph.GetRelativeRectangle(new RectangleF(treeMapNode.Rectangle.X, treeMapNode.Rectangle.Y, treeMapNode.Rectangle.Width - TreeMapChart.DataPointMargin, treeMapNode.Rectangle.Height - TreeMapChart.DataPointMargin))); }
private static void RenderDataPointLabel(ChartGraphics graph, ChartArea area, int index, TreeMapNode dataPointTreeMapNode, string text, RectangleF labelRelativeRect, RectangleF dataPointRelativeRect, RectangleF seriesLabelRelativeRect) { if (!labelRelativeRect.IsEmpty && TreeMapChart.CanLabelFit(dataPointRelativeRect, labelRelativeRect) && !labelRelativeRect.IntersectsWith(seriesLabelRelativeRect)) { StringFormat stringFormat = new StringFormat(); stringFormat.Alignment = StringAlignment.Near; stringFormat.LineAlignment = StringAlignment.Near; DataPoint dataPoint = dataPointTreeMapNode.DataPoint; graph.DrawPointLabelStringRel(area.Common, text, dataPoint.Font, new SolidBrush(dataPoint.FontColor), labelRelativeRect.Location, stringFormat, dataPoint.FontAngle, labelRelativeRect, dataPoint.LabelBackColor, dataPoint.LabelBorderColor, dataPoint.LabelBorderWidth, dataPoint.LabelBorderStyle, dataPoint.series, dataPoint, index); } }
private static void RenderDataPointLabel(ChartGraphics graph, ChartArea area, int index, TreeMapNode dataPointTreeMapNode, RectangleF seriesLabelRelativeRect) { RectangleF relativeRect = TreeMapChart.GetRelativeRect(graph, dataPointTreeMapNode); string labelText = TreeMapChart.GetLabelText(dataPointTreeMapNode.DataPoint); TreeMapChart.RenderDataPointLabel(graph, area, index, dataPointTreeMapNode, labelText, TreeMapChart.GetDataPointLabelRelativeRect(graph, dataPointTreeMapNode, relativeRect, labelText), relativeRect, seriesLabelRelativeRect); }
private static void RenderDataPoint(ChartGraphics graph, CommonElements common, int index, TreeMapNode dataPointTreeMapNode) { RectangleF relativeRect = TreeMapChart.GetRelativeRect(graph, dataPointTreeMapNode); DataPoint dataPoint = dataPointTreeMapNode.DataPoint; graph.FillRectangleRel(relativeRect, dataPoint.Color, dataPoint.BackHatchStyle, dataPoint.BackImage, dataPoint.BackImageMode, dataPoint.BackImageTransparentColor, dataPoint.BackImageAlign, dataPoint.BackGradientType, dataPoint.BackGradientEndColor, dataPoint.BorderColor, dataPoint.BorderWidth, dataPoint.BorderStyle, dataPoint.series.ShadowColor, dataPoint.series.ShadowOffset, PenAlignment.Inset, ChartGraphics.GetBarDrawingStyle(dataPoint), true); TreeMapChart.AddDataPointHotRegion(graph, common, index, dataPoint, relativeRect); }