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

Minimal CSS for integration in Angular App

Hi,

I would like to use graph in my angular(2+) app.

Is there a minimal CSS file containing specific rules for graphs ?

When I load 'resources/autogenerated/qlik-styles.css', there to many rules for global design and in conflict with my app ?

Exemple:

body {font-family: inherit!important; }
4 Replies
Anil_Babu_Samineni

My suggestion is here, Open resources/autogenerated/qlik-styles.css file in that there could be one .html page also that you can manipulate with

<body ID="Sample" Class="Sample1">

</body>

Then, CSS should written in 2 ways

#Sample {font-family: inherit!important;}

 You can like below for your next version of dashboard.

.Sample1 {font-family: inherit!important;}

 

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
matthi0uw
Partner - Contributor II
Partner - Contributor II
Author

Thanks for your answer.

My problem is to have all CSS rules and display correctly graphs (not to find how add CSS in HTML).

Anil_Babu_Samineni

Question to you, Where are you referring that CSS? Could you please brief about your work..

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
matthi0uw
Partner - Contributor II
Partner - Contributor II
Author

I have an angular app with multiple route (=url). I need to load only CSS, JS when I go in module using Qlik (to avoid unused loaded files) :

myApp.com
myApp.com/tools/...
myApp.com/dashboard/...  // only those routes use Qlik.

So I have a 'guard' that loads require.js from Qlik Server to get all JS that Qlik needs.

 

Here an exemple of demo that shows my services : https://stackblitz.com/edit/angular-s3non3 (I commented the part of injection about Qlik (require.js and qlik-styles.css) to avoid error for demo).

If load JS takes time, the guard force to wait complete then I go in the route. So I can create component to display graph like that :

//HTML:
<div id="qv01" style="height:200px;"></div>
//Typescript:
export class DashboardComponent implements OnDestroy {
  qlikApp: {};
  constructor() {
    window['require'].config( {
        baseUrl: 'http://myServerQlik/jwt/resources/',
      } );
      window['require'](['js/qlik'], (qlik: {}) => {
        this.qlik = qlik;
        resolve(true);
      });
    this.qlikApp = this.qlik['openApp']('idApp', this.config);
    this.qlikApp['getObject']('qv01', 'myGraphId');
  }

  ngOnDestroy(): void {
    this.qlikApp['close']();
  }
}

This (extract of) code loads properly the graph and data from Qlik. But CSS doesn't work :

  • loading CSS file in head tag breaks some rules of my app (not enough focus on Qlik elements).
  • loading CSS file as import, in component with no encapsulation, don't load correctly files for fonts, image (background: url()), and put wrong places for tooltips (because tooltips are add in DOM outside of my component)...
// TypeScript:
@Component({
  templateUrl: './dashboard.component.html',
  styleUrls: ['./dashboard.component.scss'],
  encapsulation: ViewEncapsulation.None,
})
export class DashboardComponent {
    ...
}
// scss :
@import  url("https://myServerQlik/jwt/resources/autogenerated/qlik-styles.css");

So where can I find a file containing minimal CSS to display graphs ? Or which rules can I remove ? How often the file changes (in case I update manually and store it in my app project) ?