Customizing Excel 2010 chart label placement using VBA - vba

I need to customize the placement of a vertical axis label on a horizontal stacked bar chart in Excel. Currently I can only place the axis label outside of the chart, but I need to show each label inside the chart - to the left or right of the bar it is associated with (depending on orientation).

The easiest way to do this is to add a text box that references the cells that contain the title values. This is much easier than customizing the chart titles themselves.

Related

Can I wrap the legends or put the legends below the pie in react-native-chart-kit Pie Chart?

In my react-native-chart-kit pie chart, there will always be either absolutely no data (which I won't show the pie chart at all) or there are exactly two pieces of data. By default, the legends are showing to the right of the pie. The actual text in the legend is coming from the name properties in data. I have tried putting in a newline character (i.e. \n) but that didn't help. So, is there a way to wrap the text in the legends to show in two lines? Or can I change the position of the legend to right below the pie?

Programmatically know if a control (or empty cell) is merged in Access Form

I'm working with MS Access VBA, an I have an stacked design in a form (the yellow grid).
it's possible to know (programmatically) if a control (or empty cell) is in merged cell or not?
Thanks.
These are not cells, these are controls (labels, textboxes, comboboxes, etc). Controls are not merged. What you see is a grouped layout. Controls are associated as a group and controls will move together if you grab and drag the box in upper left. Resize width of one control and you resize all in same "column"; resize height and you resize all in same "row". Forms and reports built by Access wizards default to grouped layout. To remove grouping: select a group > right click > Layout > Remove layout.
To determine the layout type of a control, reference its Layout property.
Me.controlname.Layout
0 = not grouped
1 = tabular
2 = stacked

Modify Z-index on Series object in Excel 2010

I am using excel 2010.
I have a chart diagram on which i put a rectangle to surround the highest column bar.
In order to make things more readable, i would like to place this rectangle on the chart but NOT in front of the lines/bars/etc...It has to be behind them.
Shape objects (like my rectangle) have a ZIndex property than can be modified in order to achieve that. Thing is, it seems impossible to put that behind the elements of my chart, nor the chart itself.
The main reason is because Chart objects and Series objects (which are the columns inside my chart) doesn't have a Z-Index property.
Is there a way which could allow me to achieve this ? Other than modifying ZIndex property ?
You can move the Chart in front of the Shape, or the Shape in front of the Chart. But what you are looking to do is to stuff the Shape behind some components of the chart, but still in front of the chart background.
That, as far as I know cannot be done.
But you can simulate the effect by making the Chart's background and the Plot area transparent (no fill, instead of the default White fill) by simply right clicking and adjusting properties.
Also, you can highlight both the chart and the shape (Ctrl-Multiple Select) and lock the two together so your Shape will look like it's a part of the chart and is behind the components.
Of course, the shape will be behind the whole chart itself (by setting the appropriate Z-value, which you may find by simply clicking on Record Macro and running the formatting once to get sample code) but since the chart's background is transparent and so is the plot area's it'll look as if the rectangle's behind the lines and all.

Dynamically creating multiple chart areas

I am creating a program which given some data files, creates charts based on these files. Rather than creating multiple charts, I have chosen to create multiple chart areas in a loop and add the various data to the chart areas. When using some sample data, which is small, the program creates 3 chart areas within a chart and works fine.
However using larger data, the program creates the chart areas but because there are over 10 chart areas to create, they do not fit into the size of the chart and also are aligned vertically rather than horizontally.
What I would like to do is increase the size of the chart fitting in all the chart areas for large data, aligning all the chart areas vertically and allowing the user to view all the chart areas via a scroll bar, since there will be a lot of chart areas using the real data files, any help will be appreciated.
The below are examples of alignment types you can switch to
Chart1.ChartAreas(0).AlignmentOrientation = AreaAlignmentOrientations.Horizontal
Chart1.ChartAreas(0).AlignmentOrientation = AreaAlignmentOrientations.Vertical
As for a scroll bar, the chart control doesn't support scroll bars. What I would do is have my original chart contained in some sort of panel/tab [any container that supports scroll bars] and then is number of charts required reaches a certain level add another chart below your original and then allow the container to build the scroll bar
'when charts required is now 5 create new chart
If Chart1.ChartAreas.Count =4 Then
Dim OverflowChart As New Chart
'add a new chart below your current chart and let the container
'have the scroll bar and not your chart control
End if
I managed to figure it soon after I posted here which is ironic. For the sake of anyone with similar problems in the future. The way I did it was to:
- Add a scrollbar to the form
- Make the blank chart as big as possible to fit whatever data which was going to be used
- Manually set the position of each chart area using ChartArea.Position and changing the posY for each chart in a loop
This worked great and gave me a lot of control as to how big I wanted the chart areas since ChartAreas.Position also has a width and height attribute and allowed me to easily align the chart areas horiziontally using the y coordinates of each chart area.

How do you remove the white box behind a chart series label?

Is there is a way to remove the white box around the series label in a chart. I am using the built in chart from the toolbox in Visual Studio 2010. This is the last part I need to finish the appearance of the chart to make it look the way I want. Please help.
I don't see the white box you are describing, but to change the properties of that section of the chart, click it in the designer, go over to the Properties window on the right, and scroll down to Legends.
Once there, hit the [...] button next to it, and that will bring up the set of all of the legends. Select the legend you want, and adjust the BorderColor property to the background color. I didn't see a means by which you could turn the border off, nor does it seem like you can set the width of the border to 0.
These can also be set programmatically, like Chart1.Legends(0).BorderColor = Color.White