Example #1
0
 public static void CalculateRectangles(RectangleF containerRect, IEnumerable <TreeMapNode> treeMapNodes, double value)
 {
     foreach (TreeMapDataPointInfo item in new TreeMapSquaringAlgorithm().Split(containerRect, value, treeMapNodes))
     {
         RectangleF  rect = item.Rect;
         TreeMapNode node = item.Node;
         node.Rectangle = rect;
         if (node.Children != null)
         {
             CalculateRectangles(node.Rectangle, node.Children, node.Value);
         }
     }
 }
 private static void RenderSeriesLabel(ChartGraphics graph, TreeMapNode seriesTreeMapNode, RectangleF labelRelativeRect)
 {
     if (!labelRelativeRect.IsEmpty)
     {
         Series    series    = seriesTreeMapNode.Series;
         DataPoint dataPoint = seriesTreeMapNode.DataPoint;
         using (Font font = 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);
         }
     }
 }
 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)
         {
             continue;
         }
         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;
     }
 }
Example #4
0
 public TreeMapDataPointInfo(RectangleF rect, TreeMapNode dataPoint)
 {
     Rect = rect;
     Node = dataPoint;
 }
        private static RectangleF GetDataPointLabelRelativeRect(ChartGraphics graph, TreeMapNode dataPointTreeMapNode, RectangleF dataPointRelativeRect, string text)
        {
            DataPoint dataPoint = dataPointTreeMapNode.DataPoint;

            return(GetLabelRelativeRect(graph, dataPoint.Font, dataPointRelativeRect, text, GetLabelAlignment(dataPoint)));
        }
 private static RectangleF GetRelativeRect(ChartGraphics graph, TreeMapNode treeMapNode)
 {
     return(graph.GetRelativeRectangle(new RectangleF(treeMapNode.Rectangle.X, treeMapNode.Rectangle.Y, treeMapNode.Rectangle.Width - DataPointMargin, treeMapNode.Rectangle.Height - DataPointMargin)));
 }
 private static void RenderDataPointLabel(ChartGraphics graph, ChartArea area, int index, TreeMapNode dataPointTreeMapNode, string text, RectangleF labelRelativeRect, RectangleF dataPointRelativeRect, RectangleF seriesLabelRelativeRect)
 {
     if (!labelRelativeRect.IsEmpty && 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 = GetRelativeRect(graph, dataPointTreeMapNode);
            string     labelText    = GetLabelText(dataPointTreeMapNode.DataPoint);

            RenderDataPointLabel(graph, area, index, dataPointTreeMapNode, labelText, GetDataPointLabelRelativeRect(graph, dataPointTreeMapNode, relativeRect, labelText), relativeRect, seriesLabelRelativeRect);
        }
        private static void RenderDataPoint(ChartGraphics graph, CommonElements common, int index, TreeMapNode dataPointTreeMapNode)
        {
            RectangleF relativeRect = 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), isVertical: true);
            AddDataPointHotRegion(graph, common, index, dataPoint, relativeRect);
        }