Hello. I have a scatter line chart and my requirement is to replace the series data labels with textboxes placed on top of the chart. Is this possible?
Hi Brian,
In the attached presentation, the first slide has the datalabels based on the series data for the chart. What I need to do is loop through these labels and replace them with textboxes placed on top of the chart as in the second slide.
Hi Brian,
chart.ChartData.Series[0].DataPoints[0].Label.TextFrameForOverriding.Text = “New text”;
The problem that I am trying to solve is being able to select all or multiple data labels using the mouse to create a selection (see attachment). Is there any way to do this?
Hi Brian,
Is there no way to get the position of a datalabel on a chart after it has been plotted?
Hi Brian,
I have observed the requirements shared by you and like to share that Aspose.Slides does allow you to alter the label X and Y position inside chart area. The position X,Y coordinates are relative to actual default position of the label where PowerPoint sets that. Please try using the following sample code on your end to get an idea as it might help in achieving your target.
public static void AddChartLab()
{
Presentation pres=new Presentation (@“C:\Aspose Data\Labels.pptx”);
IChart chart=(IChart)pres.Slides[0].Shapes[0];
double label1X = chart.ChartData.Series[0].DataPoints[0].Label.X;
double label1Y = chart.ChartData.Series[0].DataPoints[0].Label.Y;
double label2X = chart.ChartData.Series[0].DataPoints[1].Label.X;
double label2Y = chart.ChartData.Series[0].DataPoints[1].Label.Y;
double label3X = chart.ChartData.Series[0].DataPoints[2].Label.X;
double label3Y = chart.ChartData.Series[0].DataPoints[2].Label.Y;
chart.ChartData.Series[0].DataPoints[0].Label.X = 0;
chart.ChartData.Series[0].DataPoints[0].Label.Y = 0;
pres.Save(@“C:\Aspose Data\Labels2.pptx”, SaveFormat.Pptx);
}
Many Thanks,
double label1X = chart.ChartData.Series[0].DataPoints[0].Label.X;
double label1Y = chart.ChartData.Series[0].DataPoints[0].Label.Y;
Hi Brian,
NaN is returned in cases where the default position of labels is used. You can set your own value for the label by setting X and Y. If you please refer to example presentation that I have shared, I have used different location for each label in chart and hence its X,Y value is appearing. I hope this will clarify the concept.
Many Thanks,
But that doesn’t solve my issue. I need to be able to either A) get the x and y of the data label relative to the slide, not the chart so that I can place a shape in the same location, or B) put the data labels on top of chart so that multiple labels can be selected at once. There has got to be some way to do this??
Hi Brian,
I have observed your comments and like to share that for your point A, I have shared earlier with you as well that at present you can get X,Y position relative to chart plot area as data points are rendered by charting engine on runtime. However, we have already logged an issue with ID SLIDESNET-37586 to provide the support for getting absolute position of chart data point. Once this support will be available in upcoming Aspose.Slides for .NET 17.3.0 product release, you will be able to use that as per your requirements.
For your point B, I like to suggest that you may set the negative value of Y for any chart label in code sample shared by me. You may use try setting different Y values and select the one suiting your requirement for the time being.
Your requirements will be well addressed when issue SLIDESNET-37586 will be fixed. We will share the notification with you once the product will be available online by end of this month.
Many Thanks,
Thanks so much I look forward to the next version with this feature.
The issues you have found earlier (filed as SLIDESNET-37586) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
(2)