powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Microsoft Office [игнор отключен] [закрыт для гостей] / Как програмно добавить надписи
4 сообщений из 4, страница 1 из 1
Как програмно добавить надписи
    #33794012
Shkel Eugene
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
В Excel графику необходимо добавить надписи по оси X, значения добавил с помощью SeriesCollection. Надписи добавить не могу :(
...
Рейтинг: 0 / 0
Как програмно добавить надписи
    #33794098
White Owl
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Там же, в SeriesCollection есть под-коллекция DataLabels
...
Рейтинг: 0 / 0
Как програмно добавить надписи
    #33795034
Shkel Eugene
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
код можно ?

вот что я делаю с данными

Worksheets("Report").ChartObjects(3).Activate

ActiveChart.ChartArea.ClearContents
data = Strings.Replace("K96:K101", " ", "")
labels = Strings.Replace("J96:J101", " ", "")

ActiveChart.SeriesCollection.Add Source:=Worksheets("Report").Range(data)

labels - это range для надписей
...
Рейтинг: 0 / 0
Как програмно добавить надписи
    #33796600
White Owl
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Если ничто другое не помогает, прочтите наконец инструкцию:
DataLabelRepresents the data label on a chart point or trendline. On a series, the DataLabel object is a member of the DataLabels collection. The DataLabels collection contains a DataLabel object for each point. For a series without definable points (such as an area series), the DataLabels collection contains a single DataLabel object.

Using the DataLabel Object

Use DataLabels(index), where index is the data-label index number, to return a single DataLabel object. The following example sets the number format for the fifth data label in series one in embedded chart one on worksheet one.

Код: plaintext
1.
Worksheets( 1 ).ChartObjects( 1 ).Chart _
    .SeriesCollection( 1 ).DataLabels( 5 ).NumberFormat = "0.000"
Use the DataLabel property to return the DataLabel object for a single point. The following example turns on the data label for the second point in series one on the chart sheet named "Chart1" and sets the data label text to "Saturday."

Код: plaintext
1.
2.
3.
4.
5.
With Charts("chart1")
    With .SeriesCollection( 1 ).Points( 2 )
        .HasDataLabel = True
        .DataLabel.Text = "Saturday"
    End With
End With
On a trendline, the DataLabel property returns the text shown with the trendline. This can be the equation, the R-squared value, or both (if both are showing). The following example sets the trendline text to show only the equation and then places the data label text in cell A1 on the worksheet named "Sheet1."

Код: plaintext
1.
2.
3.
4.
With Charts("chart1").SeriesCollection( 1 ).Trendlines( 1 )
    .DisplayRSquared = False
    .DisplayEquation = True
    Worksheets("sheet1").Range("a1").Value = .DataLabel.Text
End With
...
Рейтинг: 0 / 0
4 сообщений из 4, страница 1 из 1
Форумы / Microsoft Office [игнор отключен] [закрыт для гостей] / Как програмно добавить надписи
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]