How to zoom in-out a pie chart using core-plot? - iphone-sdk-3.0

How to zoom in and out a pie chart in iPhone using core-plot? Any suggestions?

Change the pieRadius to change the size of the pie.

Try This :
-(void)pieChart:(CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)index{
plot.pieRadius+=10;
}

Related

Wrap or cut long labels in Pentaho CCC

How to cut long labels of the Bar Chart Control’s base axis?
I have already tried to cut them in the Extension Points (baseAxisLabel_text):
function(a){
var str=this.scene.atoms.category.label;
if (str.length>30){
str=str.substring(0,30)+' ...';
}
return str;
}
However, it seems that Chart Control width is calculated taking into account old label length. Now I have white area at the left of my bars.
How to solve this?
I found the solution.
I just moved slightly changed function from Extension Points (baseAxisLabel_text) to baseAxisTickFormatter (Advanced Properties of the chart control)
function(v){
if (v.length>30){
v=str.substring(0,30)+' ...';
}
return v;
}

ShapeRenderer camera

I'm working on platformer game (900x700). And I want to render rectangle (enemy) using ShapeRenderer but I don't see the renctangle.
for(GameObject t : enemies){
if(t instanceof Enemy){
t.update(Gdx.graphics.getDeltaTime());
render.rect(t.getHitBox().getX(), t.getHitBox().getY(), enemies.get(0).getHitBox().width, enemies.get(0).getHitBox().height);
}
}
I understand that somehow I need to convert Screen coords to World Coords. I try to use
camera.unproject();
But I need Vector3 as argument. So how can I get Vector3?
I know the answer. I need to use render.setProjectionMatrix(camera.combined); and all works great! :)

How to rotate an object from its center when using Object3d.lookAt()

I'm drawing texts and computing their bounding boxes. I always want the texts to show their face to the camera and so I'm using following lines:
textArr.forEach(function(text) {
var textGeo = d.geometry;
text.lookAt(camera.position)
})
It's working fine but it rotates from top left corner and I can't change the axis of rotation:
How can I make it rotate from center of the text while using .lookAt()?
Try center the pivot using
THREE.GeometryUtils.center(textGeo)

Sencha Touch Chart: Scroll bars with in chart panel and setting bar width

I am working on a mobile application and using sencha touch charts. By default horizontal bar chart is fitting exactly into screen. If there are more number of bars,then bars are appearing very thin and looking odd. I want to fix bar width to have uniform look and feel irrespective of number of bars being displayed. No matter even user need to scroll down to see entire chart. I have tried below option in series configuration, but it did not work.
style : {
size : 30
}
Please help me.
Thanks,
Nag.
am able to change the bar width by setting barWidth option in touchcharts-debug.js by refering to the following link
http://docs.sencha.com/touch-charts/1-0/source/Bar.html
but the axis labels are not rendering properly labels are fitting into screen
I tried this code in my interactions to render the labels, it's working fine
{
type: 'panzoom',
showOverflowArrows: false,
//axes: ['bottom'],
axes: {
bottom: false,
left: {
startZoom: 2
}
}
}

Zooming in an NSView

I have an NSView in which the user can draw circles. These circles are stored as an array of NSBezierPaths, and in drawRect:, I loop through the array and call -stroke on each of the paths. How do I add a button to zoom in and out the NSView? Just change the bounds of the view?
Thanks.
Send your view a scaleUnitSquareToSize: message.
You might also find this informative:
https://developer.apple.com/library/content/qa/qa1346/_index.html
The code in that document lets you add a "scale" property to a view.
The above answers didn't work for my scenario but led me to a solution.
The updated link to #Peter's answer was helpful: scaleUnitSquareToSize
I have found two soultions for zooming:
Cropping the bounds manually
Scalling the bounds with scaleUnitSquareToSize
I have created a small test project. Both solutions can be found on my GitHub repo : BoundsAndFramesCroppingAndScalling
To understand bounds vs frames read this SO article: difference-between-the-frame-and-the-bounds.
Swift scalling code:
let scaleSize = NSSize(width: 0.5, height: 0.5)
// 0.5 - Half the size
// 1.0 - No calling
// 2.0 - double the size , ... etc
myView?.scaleUnitSquare(to: scaleSize)
myView?.needsDisplay = true