SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
Hi guys,
I have some troubles with piecharts in swift. I want to provide custom labels outside of the piecharts segments. I found a screenshot of a nested piechart attached to an issue in your issue tracker. Thats what I want to do in swift, but I couldn’t find out a way to do so. Could you please provide an example code?
Thanks a lot in advance!
Alex
I am extending a PieSegmentLabelFormatterBase to format the segment label of a piechart. however I cannot find any information regarding how I can change its size. So my question is How can I change the font size of piechart labels?
Hello,
I get data from reading an URL so I save them (prepared) to a Arraylist (type PieSegment). How can I add the PieSegments from the Arraylist with (for example a loop) to my Piechart?
BR and thank you very much.
Marco
Hello,
I want to use the MultiplePieDonutChart. Like in the example, I want to have a touch tooltip.
I tried it with that code:
LinearLayout chartLayout = (LinearLayout) root.findViewById(R.id.chart_layout);
SciChartLegend legend = root.findViewById(R.id.pieChartLegend);
chartLayout.addView(surface);
SciChartBuilder.init(MainMenu.getActivity());
final SciChartBuilder sciChartBuilder = SciChartBuilder.instance();
final IPieRenderableSeries pieSeries = sciChartBuilder.newPieSeries().withSeriesName("HowPeopleTravel").withSegments(
sciChartBuilder.newPieSegment().withValue(34).withTitle("Ecologic").withRadialGradientColors(0xff84BC3D, 0xff5B8829).build(),
sciChartBuilder.newPieSegment().withValue(34.4).withTitle("Municipal").withRadialGradientColors(0xffe04a2f, 0xffB7161B).build(),
sciChartBuilder.newPieSegment().withValue(31.6).withTitle("Personal").withRadialGradientColors(0xff4AB6C1, 0xff2182AD).build()
).build();
final IPieRenderableSeries donutSeries = sciChartBuilder.newDonutSeries().withSeriesName("DetailedGroup").withSegments(
sciChartBuilder.newPieSegment().withValue(28.8).withTitle("Walking").withRadialGradientColors(0xff84BC3D, 0xff5B8829).build(),
sciChartBuilder.newPieSegment().withValue(5.2).withTitle("Bicycle").withRadialGradientColors(0xff84BC3D, 0xff5B8829).build(),
sciChartBuilder.newPieSegment().withValue(12.3).withTitle("Metro").withRadialGradientColors(0xffe04a2f, 0xffB7161B).build(),
sciChartBuilder.newPieSegment().withValue(3.5).withTitle("Tram").withRadialGradientColors(0xffe04a2f, 0xffB7161B).build(),
sciChartBuilder.newPieSegment().withValue(5.9).withTitle("Rail").withRadialGradientColors(0xffe04a2f, 0xffB7161B).build(),
sciChartBuilder.newPieSegment().withValue(9.7).withTitle("Bus").withRadialGradientColors(0xffe04a2f, 0xffB7161B).build(),
sciChartBuilder.newPieSegment().withValue(3.0).withTitle("Taxi").withRadialGradientColors(0xffe04a2f, 0xffB7161B).build(),
sciChartBuilder.newPieSegment().withValue(23.2).withTitle("Car").withRadialGradientColors(0xff4AB6C1, 0xff2182AD).build(),
sciChartBuilder.newPieSegment().withValue(3.1).withTitle("Motorcycle").withRadialGradientColors(0xff4AB6C1, 0xff2182AD).build(),
sciChartBuilder.newPieSegment().withValue(5.3).withTitle("Other").withRadialGradientColors(0xff4AB6C1, 0xff2182AD).build()
).build();
Collections.addAll(surface.getRenderableSeries(), pieSeries, donutSeries);
Collections.addAll(surface.getChartModifiers(), sciChartBuilder.newLegendModifier(legend).withShowCheckBoxes(false).withSourceSeries(pieSeries).build(), new PieChartTooltipModifier());
But if I touch on the chart I didn’t get the tooltip. As you see I have nearly copy all the code of the Example but I do not work. Where is my fault?
Hey Guys,
I have a requirement where I need to show Donut Chart Title , but adding any annotation is crashing my application.
let textAnnotation = SCITextAnnotation()
textAnnotation.coordinateMode = .relative
textAnnotation.x1 = SCIGeneric(0.5)
textAnnotation.y1 = SCIGeneric(0.5)
textAnnotation.horizontalAnchorPoint = .center
textAnnotation.verticalAnchorPoint = .center
textAnnotation.text = "Test"
textAnnotation.style.textStyle.fontSize = 14
textAnnotation.style.textColor = UIColor.fromARGBColorCode(0xff000000);
textAnnotation.style.backgroundColor = UIColor.clear
chartSurface.annotations = SCIAnnotationCollection(childAnnotations: [textAnnotation])
Thanks
Hello Team,
In Pie Chart with DonutSeries, the segment spacing seems to have no effect on graph.
donutSeries.segmentSpacing = 10
Thanks
Is there a way to provide custom text for the labels in a PieChartSegment? I want to format the text, but haven’t been able to find a label formatter for the pie charts.
I’m trying to create a Modifier for a PieChart Surface. I can not figure out how to get a segment for a point on the screen. With SciChartSurface, you can get the axis, and use its calculator to get a datapoint, or pixel point. Is there something similar in SciPieChartSurface?
I would like to be able to have a Pie Chart go to the very edge of the layout it’s inside. Currently it appears as though there is some default built-in padding around Pie Charts that cannot be overridden. I’ve tried manually specifying padding and margins both programmatically (on the SciChartSurface object itself) and in the layout XML, but that default padding still exists.
I’ve included a screenshot of the sample app to show the padding I’m talking about (circled in red).
I tried to create a simple pie chart, but my app crashes with the following expection:
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.scichart.drawing.common.FontStyle.initPaint(android.graphics.Paint)' on a null object reference
at com.scichart.charting.visuals.renderableSeries.PieDonutDrawingManagerBase.a(SourceFile:118)
at com.scichart.charting.visuals.renderableSeries.PieDonutDrawingManagerBase.drawLabels(SourceFile:110)
at com.scichart.charting.visuals.renderableSeries.PieRenderableSeries.internalDraw(SourceFile:70)
at com.scichart.charting.visuals.renderableSeries.PieDonutRenderableSeriesBase.onDraw(SourceFile:560)
at com.scichart.charting.visuals.c.onDraw(SourceFile:62)
at android.view.View.draw(View.java:16178)
Here is my initialization code (Kotlin):
override fun onViewCreated(view: View, savedInstanceState: Bundle?)
{
super.onViewCreated(view, savedInstanceState)
val chartSurface = view.findViewById(R.id.chart)
val builder = SciChartBuilder.instance()
val pieSeries = builder
.newPieSeries()
.withSegments(builder
.newPieSegment()
.withValue(40.0)
.build(),
builder
.newPieSegment()
.withValue(20.0)
.build())
.build()
chartSurface.renderableSeries.add(pieSeries)
}
The SciPieChartSurface is inside a CardView inside a Constraintlayout if that could matter:
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
android:id="@+id/card_chart"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.scichart.charting.visuals.SciPieChartSurface
android:id="@+id/chart"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</android.support.v7.widget.CardView>
</android.support.constraint.ConstraintLayout>
Hello, I hope you can help me! please
How could you reach this special design with androidchar.
it’s possible?
Please I need to know if it is feasible, with this I could start to carry out my project.
Thanks in advance.
I am trying to disable segment selection of pie chart.
I didn’t found any property to do it and done following way:
Is there better way to do this?
Thanks
Samvel