Macro for Setting X axis to cross the Y Axis based on a cell value - axes

I am looking to set the x axis to cross the y axis based on a value in a cell. Is there a macro I can use to accomplish this?
Thanks, Natalie

Figured it out in case anyone is curious:
Sub Set_Analyst_Medians()
ActiveSheet.ChartObjects("Chart 23").Activate
ActiveChart.PlotArea.Select
ActiveChart.SetElement (msoElementPrimaryValueAxisShow)
ActiveSheet.ChartObjects("Chart 23").Activate
ActiveChart.Axes(xlValue).Select
ActiveChart.Axes(xlValue).CrossesAt = Range("D38")
ActiveChart.Axes(xlValue).MaximumScale = Range("D49")
ActiveChart.Axes(xlValue).MinimumScale = Range("D50")
Selection.Delete
End Sub

Related

iOS -Chart: Y- Axis interval difference between value

I want to make Y-axis interval with a certain difference. Let's say the multiple of 100 or any fix value, currently it draws with their own interval.
I am sharing my formatting code here.
let leftAxis = chartView.leftAxis
leftAxis.valueFormatter = IntAxisValueFormatter()
leftAxis.granularityEnabled = true
leftAxis.granularity = 1
I am able to solve my challenge, I am adding my fix here. First I calculated the total range then divided them by interval diff and set the LabelCount.
let totalRange = maxY - minY
let interval = 100 //Let's say 100 in my case
leftAxis.setLabelCount(Int(totalRange/interval) + 1, force: true)
One way is you calculate scale value according to your data. And you can use following function to scale as you need. But exact with value difference I don't think it is possible.
self.lineChart.setScaleMinima(1.0, scaleY: 2.0)
In above value first parameter will zoom in horizontally while second will zoom vertically.

What's the best way to store a value in swift so that I can return the cell result of an x axis y axis?

My data looks like an simple price chart with hours on the X axis and mileage on the Y. The matrix of these should return the price.
Can you tell me the best way to store data in Swift to achieve this and how to access it?
Ok, so you have 2 Values and one Identifier - this is the Key for each Key Value Pair.
I would use a simple Dictionary. For example like this:
var points = [Float : [Int : Float]]()
// add Custom Value
points[10000] = [8 : 324.42]
points[10001] = [10 : 324.4241]
// get point Value
for (price, values) in points {
println(price)
for (hours, mileage) in values {
println(hours)
println(mileage)
}
}

Dealing with Bubble Chart overlap

We're working on a Highcharts Bubble Chart w/category axis and a lot of overlapping data points. Is there any way to control exactly how the bubbles are placed within the category? What we'd like to do is sort the bubbles ahead of time and then offset them from each other a bit. Some overlap is desirable so we'd prefer to not have to add additional categories to make sure there is no overlap.
Unfortunately we have no solution for controling positions of the bubbles. But you can request your propositin in our uservoice system http://highcharts.uservoice.com/
If you are using categories, your x values are the array index of the category for your value.
So to tweak the placement, you can tweak your x value by adding/subtracting small decimal amounts:
http://jsfiddle.net/yPLVP/10/
[-0.1,2,10]
Keeping in mind that +/- .5 is the center point between the categories - so for a value that falls within the 3rd category (x value 2), keep your x values between 1.55 and 2.45 (or so....)
I have the same problem, you can add this code:
function(chartObj) {
$.each(chartObj.series[0].data, function(i, point) {
var aux = 0;
if (i % 2 == 0)
aux = point.dataLabel.y + 6;
else
aux = point.dataLabel.y - 6;
point.dataLabel.attr({y:aux});
});
jsFiddle: http://jsfiddle.net/9m6wu/277/

Scaling of Gaussian Equation

I'm using Gaussian equation for a particular photo effect in an iOS application.
I use:
double sigmaX = ...; //some value here
for(int i=0;i<height;i++)
{
double F = 0;
double step = -(pos)*width/20;
/*height,width,pos - all predefined, no problem there*/
for(int j=0;j<4*width;j+=4)
{
F = (double) ((1/1)*exp(-sigmaX*(pow((step++)/1, 2.0)))) ;
//do some operation here...
}
}
and the value of F is used to determine a particular intensity which is used up elsewhere.
So far so good.... F is the typical bell curve as expected.
But, the question is, I want to scale the standard deviation of this curve as per user input.
For example, in the following image, I'd like to shift the curve from the green to the red line (blue maybe an intermediate), hopefully in linear steps:
Now, given the standard notation of:
and comparing it with the way I implemented it in my code, I got the idea to vary 1/sqrt(sigmaX) to alter the scale/SD. I tried incrementing 1/sqrt(sigmaX) in linear steps (to get linear increment) or by x^n to get power of n increment in SD, but none of that worked.
I am a bit stuck with the concept.
Can you please let me know how to scale the Standard Deviation by a predefined ratio, i.e I may want it 1.34 or 3.78 times the oirginal SD and it will scale up the the +3sigma to -3sigma span accordingly.
Your calculation here:
F = (double) ((1/1)*exp(-sigmaX*(pow((step++)/1, 2.0)))) ;
Is not reflecting the Gaussian formula you showed. It should be something like this:
double dSigma = 1.0;
static const double dRootTwoPi = sqrt(2.0 * M_PI);
F = (1.0 / (dSigma * dRootTwoPi)) * exp(-0.5 * pow(step++ / dSigma, 2.0));
Then you can vary dSigma from 1.0 to 3.0 (or whatever) to get the effect you want.
Thanks Roger Rowland, for the help... I finally got this to work:
Changed the gaussian function to:
sigmaX*=scaling;
F = (double) ((scaling / (sigmaX))*exp(-0.0005*(powf((step++/sigmaX), 2.0)))) ;
Indeed, what I had done before wasn't exactly Gaussian. This works fine and scales fine, based on the scaling parameter.
Thanks again.

Changing alpha value with increment of x coordinate value

Is it possible to give different alpha values to the same view at the same time?
I want to display color in a uiview, but it should faded out to a direction. Means I want to change its alpha value within increasing its x coordinate value.
Yes you can achieve this, but you have to remember that the range alpha value is from 0-1. So in this case you can define you can define change according to the width ie
float changeInAlphaPerX = 1/self.frame.width;
And where you are getting changed x value, you can do..
view.alpha = changeInAlphaPerX * x;
Hope it helps..

Resources