Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pie Chart only one Legend data is visible #602

Closed
TheEngineerz opened this issue Dec 10, 2015 · 1 comment
Closed

Pie Chart only one Legend data is visible #602

TheEngineerz opened this issue Dec 10, 2015 · 1 comment

Comments

@TheEngineerz
Copy link

screen shot 2015-12-10 at 11 51 16 am

What i am doing wrong here is my code

func createPieChart1(myview:UIView,y:Float){
    let  pieChart:PieChartView = PieChartView(frame: CGRectMake(0, CGFloat(y), (self.view.frame.width/1.5), (self.view.frame.width/1.5)))
    pieChart.center=CGPointMake(UIScreen.mainScreen().bounds.width/2, UIScreen.mainScreen().bounds.height/5)
    pieChart.descriptionText = ""
    pieChart.usePercentValuesEnabled = true
    pieChart.drawHoleEnabled=true
    pieChart.holeTransparent = true
    pieChart.rotationAngle = 0.0
    pieChart.rotationEnabled = true
    pieChart.legend.enabled = true
    pieChart.animate(xAxisDuration: 1.5, yAxisDuration: 1.5, easingOption: ChartEasingOption.EaseOutBack)
    myview.addSubview(pieChart)
    let  pcDatapoints = ["Present","Onleave","Absent"]
    let legend:ChartLegend = pieChart.legend
    legend.xEntrySpace = 7.0;
    legend.yEntrySpace = 0.0
    legend.yOffset = 0.0;
    legend.position = ChartLegend.ChartLegendPosition.AboveChartRight
    setPieChartData(pcDatapoints , values: pcData,pieChart:pieChart)


}
@liuxuan30
Copy link
Member

take a look at #518, seems the same.
Highlight: If I change the setCharts function to set the data after changing the colors it works fine. Best practice would be to create all your datasets first and only set the data after all the data is created.

Also, checkout pie chart in ChartsDemo. It should help you.

senabhishek added a commit to SBozhko/context-sharing-app that referenced this issue Jul 11, 2016
… Followed ChartsOrg/Charts#602. Disabled pie chart rotation and also the text does not show up on the pie chart itself now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants