Charts: لا يمكن تعيين لون الفتحة على صفر للمخطط الدائري

تم إنشاؤها على ٣ يناير ٢٠١٦  ·  6تعليقات  ·  مصدر: danielgindi/Charts

بالنسبة للثقب الشفاف ، يوصى بما يلي:

*Note: Use holeTransparent with holeColor = nil to make the hole transparent.*```

ومع ذلك ، يتسبب الإعداد التالي في حدوث عطل:

pieChart.holeTransparent = true
pieChart.holeColor = nil

بالنظر إلى التطبيق ، فإن ثقب colorColor غير ملفوف بشكل صريح ، ويفترض أنه بسبب التحقق من عدم وجود شيء يسبقه. ومع ذلك ، فإن إلغاء التغليف الصريح لا يدخل في نطاق الفحص:

if (holeColor !== nil && holeColor != UIColor.clearColor())
            {
                // draw the hole-circle
                CGContextSetFillColorWithColor(context, holeColor!.CGColor)
                CGContextFillEllipseInRect(context, CGRect(x: center.x - holeRadius, y: center.y - holeRadius, width: holeRadius * 2.0, height: holeRadius * 2.0))
            }

            // only draw the circle if it can be seen (not covered by the hole)
            if (transparentCircleRadiusPercent > holeRadiusPercent)
            {
                let alpha = holeAlpha * _animator.phaseX * _animator.phaseY
                let secondHoleRadius = radius * transparentCircleRadiusPercent

                // make transparent
                CGContextSetFillColorWithColor(context, holeColor!.colorWithAlphaComponent(alpha).CGColor)

                // draw the transparent-circle
                CGContextFillEllipseInRect(context, CGRect(x: center.x - secondHoleRadius, y: center.y - secondHoleRadius, width: secondHoleRadius * 2.0, height: secondHoleRadius * 2.0))
            }

الحل المؤقت:

pieChart.holeColor = UIColor.clearColor()

bug

التعليق الأكثر فائدة

هذا خطأ في بناء الجملة ، يجب أن يكون أقل حالة if ؛-)

ال 6 كومينتر

انت على حق :-)
لا يزال هناك بعض ! s معلقًا منذ الأيام الأولى لـ Swift عندما لم يكن من الواضح مدى خطورة أن ! ...
رحل معظمهم الآن الحمد لله!

أعتقد أنك تقصد

If let god = god {
    thank(god)
}

نتطلع إلى اختباره!

😂

هذا خطأ في بناء الجملة ، يجب أن يكون أقل حالة if ؛-)

أحتاج إلى تضمين ظل لوني داخل القطعة (مثل holecolor) يتوافق مع شريحة معينة. كيف أقوم بذلك؟

كيفية تنفيذ التسمية الفورية لإنشاء صورة في مخطط دائري
سويفت 4

هل كانت هذه الصفحة مفيدة؟
0 / 5 - 0 التقييمات