Excel Charts Hexadecimal axis values - excel

I have Hexadecimal values exported as decimal in an excel sheet (to support chart plotting).
Now, when i plot those values , in the chart's axis i get decimal values. Instead i want hexadecimal values to be shown as axis values..
How can i format the axis to show Hexadecimal values ?

Turn off the vertical axis labels and use data labels to make your own (step-by-step below):
Step 1. Select the bar chart data and create a new bar chart. Format the color.
Step 2. Select the horizontal axis. Under Format Axis > AXIS OPTIONS > Axis Type, select "Text axis".
Step 3. Select the vertical axis. Under Format Axis > LABELS > Label Position, select "None".
Step 4. Right-click the chart. Select "Select Data", then add a new series. Select the series values. Click "OK".
Step 5. Right-click the newly added series. Select "Change Series Chart Type".
Change the newly added series to "Scatter with Straight Lines" and check the "Secondary Axis" checkbox. Click "OK" and change the series color.
Step 6. Add a column of data that starts at 0.5 and increments by 1. Set these as the Series X values for the blue line. Add another three columns of data as shown below.
Step 7. Add a new series to the chart. Select the "x-Axis X" data for the Series X values and the "x-Axis Y" data for the Series Y values and click "OK" twice. Turn on the secondary horizontal axis.
Step 8. Select the newly created series, and add data labels to the left.
Step 9. Right-click the data labels and select "Format Data Labels". Under "LABEL OPTIONS. "Check Value From Cells" and select the x-Axis Labels data. Click "OK" then uncheck "Y Value" and "Show Leader Lines" back in "LABEL OPTIONS".
Step 10. Clean up. Select the x-Axis series and turn off the line and markers. Set the secondary horizontal and vertical axis labels to "None" (Format Axis > AXIS OPTIONS > LABELS).

Related

How to get a scatter Chart Series MarkerBackgroundColor if marker filling is set to Automatic?

I have a scatter chart with multiple series and a trendline per series. I want to set the trendline datalable to be the same color as the series' fill color. The series' fill color is Automatic. The .MarkerBackgroundColor property returns -1 for all series while the .MarkerBackgroundColorIndex returns 2 for all series. I believe this only happens if the marker fill is set to Automatic. However, I can't change that because the series in the chart get added through another VBA code based on dynamic data. Any help?
For i = 1 To Sheet1.ChartObjects("Chart 5").Chart.SeriesCollection.Count
With Sheet1.ChartObjects("Chart 5").Chart.FullSeriesCollection(i)
.Trendlines(1).DataLabel.Format.Fill.ForeColor.RGB = .MarkerBackgroundColor
End With
Next i
In an XY Scatter chart with the marker fill set to "automatic", Excel will apply the colors in the same order as the six theme accent colors in the current palette.
If the chart has more than six series, a lighter/darker shade of these accent colors will be applied, again in the same order. How much lighter/darker actually varies with the Excel version. The screenshot shows the legend for the first 12 series and the default "Office" palette for Office 365 for your reference.
So, if you know the order in which the series sits in the chart, you can surmise its fill color.
Thanks teylyn.
Actually, I made a quick workaround by utilizing the .Trendlines(1).Format.Line.ForeColor.RGB instead of the .MarkerBackgroundColor and it surprisingly works although the Trendline color is set to Automatic as well!
Here is the edited code:
For i = 1 To Sheet1.ChartObjects("Chart 5").Chart.SeriesCollection.Count
With Sheet1.ChartObjects("Chart 5").Chart.FullSeriesCollection(i)
.Trendlines(1).DataLabel.Format.Fill.ForeColor.RGB = .Trendlines(1).Format.Line.ForeColor.RGB
End With
Next i

Match order color and legend in stacked chart with negative values excel

[Problem]
In a very simple stacked bar graph in excel (example data below), the colors of the positive part of the chart match with the legend (i.e. yellow upper and grey lower in both stacked bars and legend). However, for the negative values the legend is inverse to the actual order of the stacked bar (i.e. blue upper and orange lower in the staked bar but the opposite in the legend).
[Unsuccessful tries]
This is regardless of the actual data in the cells (changing the data doesn't change the colors or the order).
I've tried both changing the last parameter of the formula, and changing the order of the legend manually in the menu desing > select data > move up/down. None of them works, since it changes both the order of the stacked bars and the legends at the same time, so the order keeps unmatched.
[Question]
My question is, how can I match the order of the colors of the staked bars and the legend also for the negative part of the chart?
Example data:
1 -5
2 -1
3 1
4 5

multiple legends in excel chart

Is there a way in Excel to have 2 legends for a single chart?
I have an excel chart with many series. Let's take the following structure.
X AY1 AY2 BY1 BY2 CY1 CY2
1 2 3 4 5 6 7
3 11 2 5 23 45 65
X column represents the horizontal scale the rest of the columns represent the vertical scales. A, B and C are something like a category, and Y1 and Y2 are series for each category. Now, Y1 and Y2 have the same line style, no matter what category, but the category gives the color.
So in this example Y1 is dashed and Y2 is dotted. A is blue, B is red and C is green. This leads to:
AY1 - blue dashed, AY2 - blue dotted,
BY1 - red dashed, BY2 - red dotted,
CY1 - green dashed,CY2 - green dotted.
Currently my legend is AY1, AY2 and so on, with the dash style and color.
Because I can have more than 10 categories with more than 2 series for each of them, I will end up with a legend of no. of categories * no. of series, which is not necessary.
Instead I would like a legend like: Y1 - dashed, Y2 - dotted(each series line type only once) and then a legend with the color for each category( A- red, B - blue, C - green).
Is this possible in Excel?
Thanks!
Excel only does one legend per chart. Each series will have an entry in the legend. You can manually select a legend entry and delete it.
You could manually construct a text box or similar, and place that on the chart to achieve the effect you describe.
So, if I understand correctly, I'd add two dummy series to the chart with 0 values and assign them dashed and dotted respectively, with a neutral gray color. Then delete every series but the gray ones from the legend.
Then create a drawing with the colors for the real data series and place it on top of the chart as a secondary legend.
Edit: thinking about this a bit more, here is another approach. Use dummy series purely for the purpose of showing in the legend. Consider this screenshot:
Your original data table has been charted and the series have been formatted as to your instructions above.
Then another set of data was added to the chart as new series.
Y1 and Y2 have been formatted with gray and dashed / dotted respectively
A, B and C have been added with their respective colors.
The next step is to click, select and delete the legend entries for AY1, AY2 etc., and keep only the legend entries for the helper series. Finally, edit the source data for the helper series and set all data to 0 or 1, so nothing gets plotted in the chart. The result looks like this:
You could even change the chart type for the colored helper series to a dot, so the legend will show a dot instead of a line:

Changing X axis scale in Excel

I have a X-Y scatter plot, my values in the x axis starts from the value 30.
How can i change the scale in the chart in such a way that I have values in the X axis starting from 30 and not zero?
I was able to do this in VBA as follows:
grab the chart object:
Dim objChart As Object
Set objChart = Sheets("MyWorksheetName").ChartObjects("MyChartName")
change the x-axis min value:
objChart.Chart.Axes(xlCategory).MinimumScale = myChartMinXValue
The x-axis in Excel charts seem to be called xlCategory. Also NOTE the MinimumScale property doesn't exist for all chart types. My first attempt was using xlLine but I kept getting an error. Once I switched to xlXYScatterLines VBA was happy.
right click the x-axis
select Format Axis
select the Fixed option next to Minimum and enter 30

How to change axis value labels orientation?

I have a chart in Excel; I need to change orientation of text labels in one of the axis programmatically. Ideas?
This will change the orientation of the X-axis tick labels.
ActiveChart.Axes(xlCategory).TickLabels.Orientation = 45 ' degrees
This is how to change the orientation of the axis title:
ActiveChart.Axes(xlCategory).AxisTitle.Orientation = 81 ' degrees
Have you ever tried recording macros? If not, you should! Looking at the resulting code is a great way to quickly learn this type of thing.
Layout tab (which appears when you have a chart selected) -> labels -> axis titles.
or
Right click the chart axis -> format axis -> Alignment
or
VBA solution as Jean-François Corbett pointed out

Resources