I insert a shape of type rounded rectangular callout at run time and initially its pointer's direction is downward.If i check its value using
shp.Adjustments.Item(1)
code then it shows its value -0.20833
I want to change its direction to upward.I recorded a macro to adjust that and got this code
Selection.ShapeRange.Adjustments.Item(1) = -0.20223
But still its direction is downward.
Please help to set its direction to upward.
I would suggest just rotating the shape 180 degrees on the y axis. This rotates the shape, but as you note it also rotates the text which may not be desirable.
shp.ShapeRange.ThreeD.RotationY = -180
If you simply want to adjust the pointer from the callout, this is Item(2). When I create a shape, it has a value like:
shp.Adjustments.Item(2) = 0.625
To reverse its location, so that it is on the top of the rectangle, change it to:
shp.Adjustments.Item(2) = -0.625
Related
I need help with calculation of polynomial approximation function with intercept at 0, 0 point.
I have few points in Excel like this:
Point with chart
As you can see i make chart of this point then add trend line with equation.
Now i add intercep at 0, 0 point using "Set intercept" function in chart trend line settings.
chart with intercept at 0, 0 point
Of course equation changed. Can anyone tell me how to solve it mathematically?
I have C# application where i calculate approximation but now i need functionality like in Excel - calculate approximation with intercept at point 0, 0.
For any fixed size, you could use the function =LINEST and the fact that if y = b*x + ax^2 then y is linear in the two (correlated) variables x and x^2:
In A12:C12 I entered the array formula (Ctrl + Shift + Enter` to accept)
=LINEST(A2:A10,B2:C10)
and in A14:B14 I entered
=LINEST(A2:A10,B2:C10,FALSE)
Note that in this approach it was more natural to place the y column before the x column.
Similar approaches work for higher, though fixed, degree. For something more flexible, you might want to port your C# code to VBA.
I'm trying to make some infographics based on a worldmap and bubbles, kind of like this:
Each bubble represent a country, and the size of the bubble the volume of coffee production (in this example). The exact position of the country does not really matter, as long as it's in the right regional group, but I can't let the bubbles overlap.
So I'm trying do write a macro that will adjust the X and Y coordinates of each data point, so that they don't overlap.
But for that I need to detect if bubbles overlap. What I'm thinking is simply to check the distances between the bubble centers with Xs and Ys, and compare with the bubble radius.
Hence my question: how can I determine the actual size of the bubbles? (not with the scale, but the actual size of the bubble, given the scale). I noticed they adjust based on the biggest one, which seems to be a fixed proportion of the smallest dimension of the plot area. So far it seems to be R=~ 1.29 x smallest plot area dimension, but is it always the case?
Also, if I need to change the scale, how exactly does it change the bubble size? (a scale of 200 does not seem to correspond to a sqrt(2) bigger radius)
Thanks a lot in advance!
Luc
Sub y()
Dim c As Chart
Dim s As Series
Dim p As Point
Set c = ActiveSheet.ChartObjects(1).Chart
Set s = c.SeriesCollection(1)
Set p = s.Points(1)
Debug.Print p.Left, p.Top, p.Width, p.Height ' Will be the same height & width as circle.
End Sub
I want to write a program to transform temperature dependend data into an Arrhenius plot. An Arrhenius plot show the logarithm of a property that is thermally acitavted versus the reciprocal temperature aka 1/T. Now is 1/T something that most people are not used to. This is why most of the plot also contain the translation in temperature on a second axis. Usually on top of the graph. The output should look like this:
Picture Source
The second axis is only for better readability and is corresponds to the primary axis with the relation:
primary=1/secondary
secondary=1/primary
What I am not able to do in excel-VBA (excel 2010) is the reciprocal second x-axis. There is no predefined axis scaling like this. There is xlScaleLinear and xlScaleLogarithmic for the property ScaleType of an axis. Is there a way to do this?
A secondary problem is that this:
Dim CH As Chart
Set CH = Tabelle2.ChartObjects(1).Chart
CH.ChartType = xlXYScatterLinesNoMarkers
With CH
.HasAxis(xlCategory, xlSecondary) = True
End With
Does not seem to work. Which means that a xyScatterplot does not seem to have a secondaryXaxis enabled.
I could try to add the lables and ticks myself using forms but this seems a little to much pain, I cannot be the only one who has encountered this problem.
Problem 1: How to format an axis reciprocal (1/x)?
Problem 1b: How to properly add a second x axis in a XYscatterplot?
You can do this by creating a fake axis using a series with data labels (inspired by https://peltiertech.com/secondary-axes-that-work-proportional-scales/):
Columns A and B are your data. Column C matches the X-ticks of your primary X-axis. Column D is =1/C2 etc and column E is the y-axis maximum for your chart. Now simply create a new series of columns C and E, format it to have no line and in this case I chose the + marker but you can create your own vertical line marker if you want it to be exact. Then add data labels set to range column D.
I don't think you'll find another way to do it without this hack, but it's really not that hard and doesn't require VBA which is always a plus in terms of readability / audibility of your workbook.
Another alternative would be to use the data labels to write the actual temperature to the data points:
Column C has the temperature in Celsius.
Since the Arrhenius plot is only defined as ln(k) against 1/T, this would be a good option I think.
I have a gui that provides min and max values for a selected axis, like the following for the x-axis:
'X-axis
If ListBox8.ListIndex = 0 Then
ActiveChart.Axes(xlCategory, xlPrimary).MaximumScale = TI_Chart_Tool.MultiPage1.Pages(2).TextBox2.Text
ActiveChart.Axes(xlCategory, xlPrimary).MinimumScale = TI_Chart_Tool.MultiPage1.Pages(2).TextBox3.Text
End If
At the time this occurs, the x-axis of the chart, should change accordingly, right? Initial passes, for both x and y axis, seem to work fine, while testing, i seemed to get into a state such that the chart values would only be updated, when i clicked on the chart area.
(Let me add, this state seems to occur after i change the y-axis to a logarithmic scale.)
Does anyone know how to always have the axis values be updated automatically, from within the code without having to click on the chart?
Thanks for any help!
Russ
I have a data series with 5 decimals such as 0,58861; now I plot with a XYChart as LineChart but I only see 3 numbers plotted, i.e. 0,58 or .584.
I have also tryed to change font size
yAxis.setTickLabelFont(Font.font("Arial", 5));
with no result, I always have 3 numbers plotted.
Below are two picture to show this behavior.
How to set more decimal on Y axis?
So what is wrong with that y-axis plotted numbers? You can think 0.58 as 0.58000 etc. These are just major ticks and not the points (numbers) of your data series. If you want to see more ticks and hence more precise measure values change the tickUnit parameter:
NumberAxis(double lowerBound, double upperBound, double tickUnit)
But this time if your datas range (upperBound-lowerBound) is large according to tickUnit then your graph's shape and form will degrade. To overcome this problem play with lowerBound and upperBound values to show only part of your data series as like they have been zoomified.
To change the tick label font and size, try:
yAxis.setTickLabelFont(Font.font("Arial", FontWeight.MEDIUM, 18));
Changing the font size will not help. You have to change the tick label formatter using the setTickLabelFormatter function.