Exemple #1
0
        //private void renderCategoryLabels()
        //{
        //	if (FocusedSegment == null)
        //	{
        //		return;
        //	}
        //	var context = new ProviderContext(Data.Count);
        //	MaterialProvider.Reset(context);
        //	_categoryLabels.Children.Clear();
        //	var diameter = _segments.RenderSize.Smallest() * CircleScale;

        //	var outerLabelRadius = (diameter / 2) * OuterLabelPositionScale;
        //	var overlayedLabelRadius = (diameter / 2) * .7;

        //	var targetAngularOffset = FocusedSegment.RequireType<ArcPath>().CalculateAngularOffset();

        //	foreach (var d in Data)
        //	{
        //		var materialSet = MaterialProvider.ProvideNext(context);
        //		var categoryNameLabel = positionLabel(d, outerLabelRadius, targetAngularOffset, true);

        //		categoryNameLabel.Content = d.CategoryName;
        //		categoryNameLabel.BindTextualPrimitive<BarTotalPrimitive>(this);
        //		categoryNameLabel.Foreground = BarTotalForeground.GetMaterial(materialSet);
        //		_categoryLabels.Children.Add(categoryNameLabel);


        //		var valueLabel = positionLabel(d, overlayedLabelRadius, targetAngularOffset);

        //		valueLabel.Content = d.Value;
        //		valueLabel.BindTextualPrimitive<ValuePrimitive>(this);
        //		valueLabel.Foreground = ValueForeground.GetMaterial(materialSet);
        //		_categoryLabels.Children.Add(valueLabel);
        //	}
        //}

        private Label positionLabel(CategoricalDouble d, double radius, double targetAngularOffset,
                                    bool horizontalPositionSkew = false)
        {
            var categoryLabel = new Label
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
                IsHitTestVisible    = false
            };

            var pretransformedOffset     = d.RenderedVisual.RequireType <ArcPath>().PolarOffset;
            var arcAngle                 = d.RenderedVisual.RequireType <ArcPath>().ArcAngle;
            var pretransformedLabelAngle = pretransformedOffset + (arcAngle / 2);
            var actualLabelAngle         = pretransformedLabelAngle - targetAngularOffset;

            var horizontalLabelSkew = horizontalPositionSkew
                                ? Math.Cos(CoordinateHelpers.ToRadian(actualLabelAngle)) * HorizontalLabelPositionSkew
                                : 0;

            var labelRadius     = radius;
            var polarPoint      = new PolarPoint(actualLabelAngle, labelRadius);
            var labelCoordinate = polarPoint.ToCartesian();

            categoryLabel.Margin = new Thickness(labelCoordinate.X + horizontalLabelSkew, -labelCoordinate.Y,
                                                 -labelCoordinate.X - horizontalLabelSkew, labelCoordinate.Y);
            return(categoryLabel);
        }
		public RingSegmentGeometry(double arcAngle, double polarOffset, Size renderSize, 
			double ringWidth, CategoricalDouble dataSource) : base(dataSource)
		{
			ArcAngle = arcAngle;
			PolarOffset = polarOffset;
			RenderSize = renderSize;
			RingWidth = ringWidth;
			DataSource = dataSource;
		}
 public RingSegmentGeometry(double arcAngle, double polarOffset, Size renderSize,
                            double ringWidth, CategoricalDouble dataSource) : base(dataSource)
 {
     ArcAngle    = arcAngle;
     PolarOffset = polarOffset;
     RenderSize  = renderSize;
     RingWidth   = ringWidth;
     DataSource  = dataSource;
 }
 protected GraphElementGeometry(CategoricalDouble dataSource)
 {
     DataSource = dataSource;
 }
		protected GraphElementGeometry(CategoricalDouble dataSource)
		{
			DataSource = dataSource;
		}