Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Case Portal has moved to Qlik Community! Read the FAQs to start exploring Support resources.
cancel
Showing results for 
Search instead for 
Did you mean: 
garethrogers
Contributor
Contributor

Labels on data points in scatter chart: toggle display and truncate?

Any suggestions as to how I can accomplish a couple of things related to labels on data points in scatter chart?

1.  I know how to either display them, not display them, or display them only if the number of labels on the chart is less than a specified integer.  (Properties -> Presentation -> Labels on Datapoints check box & Max Labels Shown entry.  Ideally I would like a button which will toggle the display off/on as the user sees fit.  In effect, toggling the Labels on Datapoints check box setting.


2.  When displayed I'd like to truncate the value of the dimension displayed to 8 characters like I can do in the Legend settings.  (Yes, I could make a calculated dimension but some of them have the same first 8 characters so this solution doesn't help).

Thanks.

1 Solution

Accepted Solutions
m_woolf
Master II
Master II

I don't know about changing the labels, but the user can turn them on/off with a macro.

Create a variable named vShowLabels.

sub ScatterLabels

set v = ActiveDocument.Variables("vShowLabels")

strShowLabels = v.GetContent.String

set chart = ActiveDocument.GetsheetObject("CH66")

set gp = chart.GetProperties

if strShowLabels = "Yes" then

gp.ChartProperties.ScatterLabelsInChart = false

v.SetContent "No",true   

else

gp.ChartProperties.ScatterLabelsInChart = true

v.SetContent "Yes",true   

end if

' gp.ChartProperties.ScatterLabelPosVertical = 0      'top    

' gp.ChartProperties.ScatterLabelPosHorizontal = 5    'center

chart.SetProperties gp

end sub

View solution in original post

2 Replies
m_woolf
Master II
Master II

I don't know about changing the labels, but the user can turn them on/off with a macro.

Create a variable named vShowLabels.

sub ScatterLabels

set v = ActiveDocument.Variables("vShowLabels")

strShowLabels = v.GetContent.String

set chart = ActiveDocument.GetsheetObject("CH66")

set gp = chart.GetProperties

if strShowLabels = "Yes" then

gp.ChartProperties.ScatterLabelsInChart = false

v.SetContent "No",true   

else

gp.ChartProperties.ScatterLabelsInChart = true

v.SetContent "Yes",true   

end if

' gp.ChartProperties.ScatterLabelPosVertical = 0      'top    

' gp.ChartProperties.ScatterLabelPosHorizontal = 5    'center

chart.SetProperties gp

end sub

View solution in original post

garethrogers
Contributor
Contributor
Author

Works like a champ for the toggle.  Thanks!

Any takers for #2, the truncation of the text that displays?