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 RenderLabels(ChartGraphics graph, ChartArea area, List <TreeMapNode> seriesTreeMapNodes) { foreach (TreeMapNode seriesTreeMapNode in seriesTreeMapNodes) { if (seriesTreeMapNode.DataPoint != null) { RectangleF relativeRect = TreeMapChart.GetRelativeRect(graph, seriesTreeMapNode); RectangleF rectangleF = TreeMapChart.GetSeriesLabelRelativeRect(graph, area, seriesTreeMapNode.Series, relativeRect, seriesTreeMapNode.DataPoint); if (!TreeMapChart.CanLabelFit(relativeRect, rectangleF)) { rectangleF = RectangleF.Empty; } int num = 0; foreach (TreeMapNode child in seriesTreeMapNode.Children) { DataPoint dataPoint = child.DataPoint; RectangleF rectangle = child.Rectangle; TreeMapChart.RenderDataPointLabel(graph, area, num, child, rectangleF); num++; } TreeMapChart.RenderSeriesLabel(graph, seriesTreeMapNode, rectangleF); } } }