Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
IAMDV
Luminary Alumni
Luminary Alumni

Dynamic Chart (VB Script)

Dear All,

I have a requirement to generate 4 dynamic charts based on the user selection. So I had decided to use $Field to display all dimension fields and then I wanted the user to select dimensions. Then my charts should populate based on the dimension.

I had started to write some VB Script but I need more help on this...

Sub Dynamic_Chart_Dimension_01

Set MyChart = ActiveDocument.GetSheetObject("CH67")

MyChart.SetReference

MyChart.AddDimension "Gender"   -- This line of code now adds dimension

MyChart.AddExpression "COUNT(Resp_ID)"  -- This line adds expression

End Sub

~Here is what I need...

1. I wanted to check if there is already dimension then the VB Script should replace the Dimension. However, if there is no Dimension then we need to add one. So it should simple IF, ELSE & End IF construct.

2. Instead of using "Gender" as dimension I wanted an expression... something like the first selection from the list box. And for the next Chart the script should take the second selection from the list box.

Many thanks in anticipation!

Cheers - DV

6 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    I am here by uploading an example.

    Hope this is what you are looking for

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
IAMDV
Luminary Alumni
Luminary Alumni
Author

Kaushik - Thanks mate. This is almost what I wanted to do... However, there couple things which are missing.

1. What is the easiest way to replicate the same for 4 charts? I have charts in my sheet.

2. This does not work immediately. I mean if I select a dimension it does not show the breakdown immediately. It shows only after I select one more dimension. I guess this is because of volume of data. I have my dataset with 10 million records.

Can you think of a method to refresh the chart immediately after pressing the button. (Although it works fine in your example).

Cheers - DV

nagaiank
Specialist III
Specialist III

Did you consider using cyclic group as dimension? This will help you select any one dimension dynamically.

If you use the same cyclic group in all your four charts,choosing a dimension in one chart will result in choosing the same dimension in other three charts automatically.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   Can you send me the qvw with file and 4 charts which you want.

   Yes due to volume of data it may take time.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable

Dear Kaushik,

I hope you are doing well, This is kumar and i am new to the qlikview,

Kindly help me out with below problem

i have two table 1 and 2 with filed names A, B, i want to create relation b/w fields A and A, then update Table 1 field B with Table 2 Field B Values, Which is same as MS Access update query

Thanks

Kumar

Not applicable

Dear Kaushik,

I hope you are doing well, This is kumar and i am new to the qlikview,

Kindly help me out with below problem

i have two table 1 and 2 with filed names A, B, i want to create relation b/w fields A and A, then update Table 1 field B with Table 2 Field B Values, Which is same as MS Access update query

Thanks

Kumar