@assistantapps/swat-chart
v0.0.8
Published
Swat chart made for use in AssistantApps and other projects
Readme
Swat Chart
A simple chart to be used in your projects.
Links
Install
npm install @assistantapps/swat-chartUsage
import { generateSwatChart } from '@assistantapps/swat-chart';
const svgContent = generateSwatChart({
chart: {
width: 800,
height: 400,
borderRadius: 20,
lineWidth: 3,
padding: { x: 20, y: 20 },
},
colour: {
backgroundFill: '#DFFFDF',
// ...
},
// etc ...
});<div dangerouslySetInnerHTML={{ __html: svgContent }} /><div class="display" innerHTML={svgContent} />// component.ts
import { Component } from '@angular/core';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
@Component({
selector: 'app-root',
template: `<div [innerHTML]="safeSvg"></div>`
})
export class AppComponent {
svgContent: string = generateSwatChart({ /* config */ });
safeSvg: SafeHtml;
constructor(private sanitizer: DomSanitizer) {
this.safeSvg = this.sanitizer.bypassSecurityTrustHtml(this.svgContent);
}
}