Change the source of a Datalable (1 Viewer)

Ari96

New member
Local time
Today, 17:33
Joined
Feb 10, 2022
Messages
2
Hi everyone,

I have a example table that looks like this.
Table.PNG


I crated a line chart with the column x As the values for the x-Axis, and the column y for the y Axis.
Graph.PNG

When I activate the datalabels, I see the y-Values as intended. But I instead want to have the values of the column "Testdate" there. Example with one value.
Graph2.png

Is this possible with vba, as I am building my original chart with vba?

Thanks in advance.
 

oleronesoftwares

Passionate Learner
Local time
Today, 08:33
Joined
Sep 22, 2014
Messages
1,159
Pls share the vba code you are using to build it. Test date is a date field, so surely you can't sum a date field.
 

Ari96

New member
Local time
Today, 17:33
Joined
Feb 10, 2022
Messages
2
Hi,

the Sum-thing I did on accident in this example.
graph4.PNG

I only want to replace the yellow marked values with the dates of the column "Testdate".
 

oleronesoftwares

Passionate Learner
Local time
Today, 08:33
Joined
Sep 22, 2014
Messages
1,159
Then replace the place where Y is in your code with testdate.

Still waiting to see the VBA you used.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 10:33
Joined
Feb 28, 2001
Messages
27,195
I made a post but after re-reading this thread, I am changing my first answer.

Your chart is doing exactly what you told it to do. Your X values on the chart (category axis) correspond exactly with the values in the table. The Y data labels in the chart (value axis) correspond exactly with the Y values in the table. You are asking to plot a third value (the date) in place of the 2nd value (Y) that is neither a plot category nor a plot value.

However, the chart object doesn't have an option (that I can see) to do this. We have to remember that the Chart Object is pretty much a "black box" that we don't get to modify. We can only feed it what it will take. I can't see where it takes a set of labels for data points. It will either show or not show the value of each data point.

If one of my colleagues knows of how to introduce an externally supplied label for a point (where the data point's value and the external label are not otherwise related), I will defer to their expertise. But offhand, I don't see a mechanism.
 
Last edited:

Users who are viewing this thread

Top Bottom