Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
sayaleesangle
Contributor
Contributor

Create chart using script?

How can we create the chart (Bar chart,line chart etc.) using script? in the Qlikview?

6 Replies
Anil_Babu_Samineni

Nit sure about your request. Charts comes and design from charts

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
qlikviewwizard
Master II
Master II

We won't create charts with script but we will create data sets/table.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

You cannot create charts from the script (no DOM, no ActiveDocument so no working API functions that manipulate the DOM)

If you're working in QV Desktop however, you can create all the necessary data tables and variables in your script, add a suitable macro that creates the object(s) you want to see, and run the macro using the OnPostReload trigger.

Examples of how to create objects using mcaros? See here: Macro generates chart but continously and I want once  or here: Create Custom Chart with Macro

sayaleesangle
Contributor
Contributor
Author

I got the below script on the internet but as I am new to QlikView I am unable to understand it..If anyone having knowledge about it please tell me.

Thank you

  1. Load file(s) into TABLE1 
  2.  
  3. declare X integer 
  4.      , total_columns integer 
  5.      , field_name varchar 
  6.  
  7. set X = 1 
  8. set total_columns = count(columns) from TABLE1 
  9.  
  10. While X <= total_columns 
  11.   begin 
  12.     Set field_name = name(columnnumber(X)) 
  13.  
  14.     Create_chart [name: chart + string(X) 
  15.           , type: barchart 
  16.           , x_axis: columnnumber(X) 
  17.           , y_axis: count(*) 
  18.           , title: field_name 
  19.           , appearance: default] 
  20.     X = X + 1 
  21.   end 
  22.  
  23. Auto-arrange page 
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Since "the internet" is a huge repository of scripts in various programming languages, the script you posted may be targeted to a product that is unrelated to those by Qlik. Do you know what language it is written in?

BTW QlikView macros can be written in either VBScript or JavaScript. AFAIK VBScript is the more popular macro programming lagnuae (although it is seriously less powerful than JavaScript)

Anonymous
Not applicable

Dear Sayalee,
In QlikView for chart visualizations we can use from given style or can use extensions for customized chart.
We can write some expressions for charts in scripting.