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

CombinedChartView bubbleData size not working #692

Closed
jasonxiaochao opened this issue Jan 21, 2016 · 2 comments
Closed

CombinedChartView bubbleData size not working #692

jasonxiaochao opened this issue Jan 21, 2016 · 2 comments

Comments

@jasonxiaochao
Copy link

yBubbleVals.append(BubbleChartDataEntry(xIndex: i, value: 10, size: 10))

the size is not working ,
thie bubble width always equals the bar width

@liuxuan30
Copy link
Member

I am not sure why, but changing below code in bubble chart renderer drawDataSet func would make bubbles different size (using ChartsDemo):

//            let shapeSize = getShapeSize(entrySize: entry.size, maxSize: dataSet.maxSize, reference: referenceSize)
            let shapeSize = entry.size // directly use
            let shapeHalf = shapeSize / 2.0

So seems the reason is getShapeSize. I print out a few, seems they are quite close, becaue the value is already in pixel

    private func getShapeSize(entrySize entrySize: CGFloat, maxSize: CGFloat, reference: CGFloat) -> CGFloat
    {
        let factor: CGFloat = (maxSize == 0.0) ? 1.0 : sqrt(entrySize / maxSize)
        let shapeSize: CGFloat = reference * factor
        return shapeSize
    }
(lldb) po shapeSize
23.3481437335035

(lldb) po shapeSize
26.2410481770833

(lldb) po shapeSize
24.8367512492309

(lldb) po shapeSize
21.7579277272562

bubble

I would not say it equals to bar width, but the difference is small. You will see the second and third bubble are bigger than 4th one, which is identical to above shape size.
@petester42 do you have idea why getShapeSize is implemented this way?

@danielgindi
Copy link
Collaborator

The size was always being normalized against the max size in the dataset.
You can now turn it off by using normalizeSizeEnabled = false, on master

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

3 participants