DIAdem Help

Object: CurveLegendColumnPieChart

  • Updated2024-09-12
  • 2 minute(s) read

Object: CurveLegendColumnPieChart

The CurveLegendColumn object provides the properties of a column of a curve legend

The following example deletes all columns in the legend except the first column, in the pie chart of the current worksheet:

VBScriptPython

 

Dim oMyReportObj, oMyReportObjects 
Set oMyReportObjects = Report.ActiveSheet.Objects
For Each oMyReportObj in oMyReportObjects
  If oMyReportObj.ObjectType = eReportObjectPieChart Then
    oMyReportObj.CurveLegend.Columns.RemoveAll
  End If
Next

The following example generates a pie chart and the legend:

VBScriptPython

 

Dim oMyPieChart, oMyCurvePieChart, oMyPos, oMySliceLabel, oMyLegend, oMyCurveLegendPos, oMyLegendColumns
Call Data.Root.Clear()
Call DataFileLoad(DataReadPath & "Example.tdm","TDM","")
Report.NewLayout
Set oMyPieChart = Report.ActiveSheet.Objects.Add(eReportObjectPieChart, "MyPieChart")
Set oMyPos = oMyPieChart.Position.ByCoordinate
oMyPos.X1 = 20
oMyPos.X2 = 80
oMyPos.Y1 = 20
oMyPos.Y2 = 80
Set oMyCurvePieChart = oMyPieChart.CurvePieChart
oMyCurvePieChart.Channel.Reference = "[5]/[4]" 
Set oMySliceLabel = oMyCurvePieChart.SliceLabel
oMySliceLabel.CategoryVisible = True
oMySliceLabel.Channel.Reference = "[5]/[1]" 
oMySliceLabel.CategoryMode = eCategoryModeChannel
Set oMyLegend = oMyPieChart.Legend
oMyLegend.Visible = True
Set oMyCurveLegendPos = oMyLegend.Position
oMyCurveLegendPos.RelativePosition = eLegendRelativePositionTopLeft
oMyCurveLegendPos.SizeMode = eLegendSizeElementwise
oMyCurveLegendPos.ElementHeight = 5
oMyCurveLegendPos.ElementWidth = 35
oMyLegend.Settings.Font.Size = 4
Set oMyLegendColumns = oMyLegend.Columns
Call oMyLegendColumns.Add
oMyLegendColumns(1).Title = "First title"
oMyLegendColumns(1).Type = eLegendTextPieChartCustomText
oMyLegendColumns(1).RelativeWidth = 2
oMyLegendColumns(1).Text = "First col - longer text"
oMyLegendColumns(2).Title = "Second title"
oMyLegendColumns(2).Type = eLegendTextPieChartSliceRelatedText
oMyLegendColumns(2).RelativeWidth = 2
oMyLegendColumns(2).Text = "Second col"
Call Report.Refresh()

Properties

RelativeWidth | Text | Title | Type