Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
vvvvvvizard
Partner - Specialist
Partner - Specialist

related to macro for a combo chart

I successfully created a combo chart using a macro

both expressions are bars , how do i set one expression as a Bar and the other as a line in the same chart.

Below is the code used

Sub GenerateComboChart()

Dim myChart

' Create a new Bar Chart

Set myChart = _

ActiveDocument.ActiveSheet().CreateComboChart

' Add a dimension of Country to the new chart

myChart.AddDimension "MonthYear"

myChart.AddDimension "Alias"

myChart.AddExpression "=Avg([Saturation Index (%)])"

myChart.AddExpression "=Max([Saturation Index (%)])"

' Get the properties object

Dim cp

Set cp = myChart.GetProperties()

' Set the title of the dimension

cp.Dimensions(0).Title.v = "Alias"

' Set the Title-in-chart text

cp.ChartProperties.Title.Title.v = sitearray(0)

' Set the Window title

cp.GraphLayout.WindowTitle.v =  sitearray(0)

' Set sort by Y-Value

cp.SortByYValue = -1

' Get the expression properties

Dim expr, exprvis

Set expr = _

cp.Expressions.Item(0).Item(0).Data.ExpressionData

Set exprvis = _

cp.Expressions.Item(0).Item(0).Data.ExpressionVisual

' Set the Expression label

exprvis.Label.v = "Sales $"

' Set the "Values on Data Point" option

exprvis.NumbersOnBars = -1

' Set the number format for the expression

exprvis.NumberPresentation.Dec = "."

exprvis.NumberPresentation.Fmt = "#,##0.00"

exprvis.NumberPresentation.nDec = 2

exprvis.NumberPresentation.Thou = ","

exprvis.NumberPresentation.Type = 11 'fixed

exprvis.NumberPresentation.UseThou = 1

' Apply the modified properties

myChart.SetProperties cp

End Sub

13 Replies
petter
Partner - Champion III
Partner - Champion III

That depends on what you are thinking about - I have example on how to create and enable the prj folder. But I have never tried to parse the XML-files resulting from it although I have browsed through them as XML with a good editor like Notepad++ ... And I have tried manually to change some properties. QlikView actually read these files also every  time it reads the corresponding QVW ... and writes them every time it save the QVW.

It is a feature that enables and is necessary for version control.

petter
Partner - Champion III
Partner - Champion III

If you are referring to the prj-files then:

Look in the QlikView Reference Manual on page 45 (of QV 11.20 SR10 manual) you will find chapter 9.1 QlikView Project Files explaining it ....

robert_mika
Master III
Master III

Really helpful Petter.

Thanks for that.

Opens many new doors..

Here is a link if someone needs to find more about pjr files.

Creating prj Folder

robert_mika
Master III
Master III

You are right yusuf .

In addition I think API does not include all object  properties.

On the bright side I found the macro examples very useful,