Hi all,
I am trying to have a bar chart using:
ln = slicer.mrmlScene.GetFirstNodeByClass(‘vtkMRMLLayoutNode’)
ln.SetViewArrangement(24)
# Get the first ChartView node
cvn = slicer.mrmlScene.GetFirstNodeByClass('vtkMRMLChartViewNode')
# Create another data array
dn5 = slicer.mrmlScene.AddNode(slicer.vtkMRMLDoubleArrayNode())
a = dn5.GetArray()
a.SetNumberOfTuples(4)
a.SetComponent(0, 0, 6)
a.SetComponent(0, 1, 32)
a.SetComponent(1, 0, 3)
a.SetComponent(1, 1, 12)
a.SetComponent(2, 0, 4)
a.SetComponent(2, 1, 20)
a.SetComponent(3, 0, 5)
a.SetComponent(3, 1, 6)
# Create another ChartNode
cn = slicer.mrmlScene.AddNode(slicer.vtkMRMLChartNode())
# Add data to the chart
cn.AddArray('Volumes', dn5.GetID())
# Configure properties of the Chart
cn.SetProperty('default', 'title', 'A chart with labels')
cn.SetProperty('default', 'xAxisLabel', 'structure')
cn.SetProperty('default', 'xAxisType', 'categorical')
cn.SetProperty('default', 'yAxisLabel', 'size (cm)')
cn.SetProperty('default', 'type', 'Bar');
cn.SetProperty('Volumes', 'lookupTable', slicer.util.getNode('GenericAnatomyColors').GetID() )
# Set the chart to display
cvn.SetChartNodeID(cn.GetID())
self.delayDisplay('A chart with labels')
So how to enable those “data labels” in the bar circled in red?
Thanks a lot,
Aiden