Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@iapps/d2-visualizer

Package Overview
Dependencies
Maintainers
15
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@iapps/d2-visualizer - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

src/lib/modules/map/class/map-drawable.class.d.ts

2

package.json
{
"name": "@iapps/d2-visualizer",
"version": "1.0.2",
"version": "1.0.3",
"type": "commonjs",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

@@ -0,1 +1,2 @@

import { LegendSet } from './modules/map/models/legend-set.model';
import { VisualizationConfiguration } from './shared/visualization-configuration';

@@ -6,3 +7,5 @@ import { VisualizationLayout } from './shared/visualization-layout';

dataSelections: any[];
geoFeatures: any[];
dataAnalytics: unknown;
legendSet: LegendSet | undefined | any;
type: VisualizationType;

@@ -50,2 +53,14 @@ visualizationType: VisualizationType;

/**
*
* @param geoFeatures
* @returns
*/
setGeoFeatures(geoFeatures: any): this;
/**
*
* @param legendSet
* @returns
*/
setLegendSet(legendSet: LegendSet): this;
/**
* @description Get data selection layout orientation

@@ -52,0 +67,0 @@ * @returns {VisualizationLayout}

@@ -7,2 +7,4 @@ "use strict";

const chart_visualizer_1 = require("./modules/chart/chart-visualizer");
const table_visualizer_1 = require("./modules/table/table-visualizer");
const map_util_1 = require("./modules/map/utils/map.util");
const visualization_configuration_1 = require("./shared/visualization-configuration");

@@ -13,3 +15,5 @@ const visualization_layout_1 = require("./shared/visualization-layout");

this.dataSelections = [];
this.geoFeatures = [];
this.dataAnalytics = null;
this.legendSet = null;
}

@@ -71,2 +75,20 @@ /**

/**
*
* @param geoFeatures
* @returns
*/
setGeoFeatures(geoFeatures) {
this.geoFeatures = geoFeatures;
return this;
}
/**
*
* @param legendSet
* @returns
*/
setLegendSet(legendSet) {
this.legendSet = legendSet;
return this;
}
/**
* @description Get data selection layout orientation

@@ -107,12 +129,34 @@ * @returns {VisualizationLayout}

return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
console.log("should be CHART | MAP | REPORT_TABLE");
console.log(this.visualizationType);
if (this.dataAnalytics) {
return new chart_visualizer_1.ChartVisualization()
.setId(this.id)
.setConfig(this.config.config)
.setData(this.dataAnalytics)
.setVisualizationType(this.visualizationType)
.setChartType(this.chartType)
.draw();
switch (this.visualizationType) {
case 'CHART':
return new chart_visualizer_1.ChartVisualization()
.setId(this.id)
.setConfig(this.config.config)
.setData(this.dataAnalytics)
.setVisualizationType(this.visualizationType)
.setChartType(this.chartType)
.draw();
case 'MAP':
return new map_util_1.MapUtil()
.setMapAnalytics(this.dataAnalytics)
.setGeofeature(this.geoFeatures)
.setLegendSet(this.legendSet)
.setContainer('map-container-demo')
.setType('thematic')
.setShowLabel(true)
.draw();
case 'REPORT_TABLE':
return new table_visualizer_1.TableVisualization()
.setId(this.id)
.setConfig(this.config)
.setData(this.dataAnalytics)
.draw();
default:
return null;
}
}
else {
if (!this.dataAnalytics) {
const data = yield this.getData();

@@ -128,2 +172,10 @@ switch (this.visualizationType) {

.draw();
case 'MAP':
return new map_util_1.MapUtil()
.setMapAnalytics(this.dataAnalytics)
.setGeofeature(this.geoFeatures)
.setLegendSet(this.legendSet)
.setContainer('map-container-demo')
.setShowLabel(true)
.draw();
default:

@@ -130,0 +182,0 @@ return null;

@@ -14,2 +14,3 @@ import { VisualizationConfiguration } from '../../shared/visualization-configuration';

private _chart;
private _dataSelections;
/**

@@ -40,2 +41,8 @@ *

/**
* @description Set data selection criterias
* @param dataSelections {any[]}
* @returns {D2Visualizer}
*/
setSelections(dataSelections: any[]): this;
/**
*

@@ -42,0 +49,0 @@ * @param config

@@ -53,2 +53,11 @@ "use strict";

/**
* @description Set data selection criterias
* @param dataSelections {any[]}
* @returns {D2Visualizer}
*/
setSelections(dataSelections) {
this._dataSelections = dataSelections;
return this;
}
/**
*

@@ -55,0 +64,0 @@ * @param config

@@ -14,1 +14,14 @@ export interface MapFeatures {

}
export interface DhisGeoFeature {
id: string;
code: string;
na: string;
hcd: boolean;
hcu: boolean;
le: number;
pg: string;
pi: string;
pn: string;
ty: number;
co: string;
}

@@ -1,2 +0,57 @@

export declare class D2TableVisualizer {
import { DownloadFormat } from '../../shared/download-format';
import { VisualizationConfiguration } from '../../shared/visualization-configuration';
import { VisualizationType } from '../../shared/visualization-type';
export declare class TableVisualization {
private _visualizationType;
private _data;
private _config?;
private _id;
private _layout;
private _chart;
private _dataSelections;
/**
*
* @param id
* @returns
*/
setId(id: string): this;
/**
*
* @param visualizationType
* @returns
*/
setVisualizationType(visualizationType: VisualizationType): this;
/**
*
* @param chartType
* @returns
*/
setChartType(chartType: string): this;
/**
*
* @param data
* @returns
*/
setData(data: any): this;
/**
* @description Set data selection criterias
* @param dataSelections {any[]}
* @returns {D2Visualizer}
*/
setSelections(dataSelections: any[]): this;
/**
*
* @param config
* @returns
*/
setConfig(config: VisualizationConfiguration): this;
/**
*
*/
draw(): void;
/**
*
* @param downloadFormat
*/
download(downloadFormat: DownloadFormat): void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.D2TableVisualizer = void 0;
class D2TableVisualizer {
exports.TableVisualization = void 0;
const visualization_layout_1 = require("../../shared/visualization-layout");
const table_helper_1 = require("./helpers/table-helper");
class TableVisualization {
constructor() {
this._visualizationType = 'REPORT_TABLE';
this._layout = new visualization_layout_1.VisualizationLayout();
}
/**
*
* @param id
* @returns
*/
setId(id) {
this._id = id;
return this;
}
/**
*
* @param visualizationType
* @returns
*/
setVisualizationType(visualizationType) {
this._visualizationType = visualizationType;
return this;
}
/**
*
* @param chartType
* @returns
*/
setChartType(chartType) {
this._chart = chartType;
return this;
}
/**
*
* @param data
* @returns
*/
setData(data) {
this._data = data;
return this;
}
/**
* @description Set data selection criterias
* @param dataSelections {any[]}
* @returns {D2Visualizer}
*/
setSelections(dataSelections) {
this._dataSelections = dataSelections;
return this;
}
/**
*
* @param config
* @returns
*/
setConfig(config) {
console.log('what configs are passed');
console.log(config);
this._config = config;
return this;
}
/**
*
*/
draw() {
// add logic to draw table
(0, table_helper_1.tableCreate)(this._id, this._data, this._config);
}
/**
*
* @param downloadFormat
*/
download(downloadFormat) {
var _a;
const filename = ((_a = this._config) === null || _a === void 0 ? void 0 : _a.name) || 'chart-data';
switch (downloadFormat) {
case 'PNG':
this._chart.exportChart({ filename, type: 'image/png' });
break;
case 'CSV':
this._chart.getCSV();
break;
}
}
}
exports.D2TableVisualizer = D2TableVisualizer;
exports.TableVisualization = TableVisualization;
//# sourceMappingURL=table-visualizer.js.map

@@ -45,2 +45,6 @@ import { VisualizationType } from './visualization-type';

get longitude(): string;
get height(): string;
get width(): string;
get mapboxApiKey(): string;
get mapboxStyle(): string;
}

@@ -168,4 +168,20 @@ "use strict";

}
get height() {
var _a;
return (_a = this.config) === null || _a === void 0 ? void 0 : _a.height;
}
get width() {
var _a;
return (_a = this.config) === null || _a === void 0 ? void 0 : _a.width;
}
get mapboxApiKey() {
var _a;
return (_a = this.config) === null || _a === void 0 ? void 0 : _a.mapboxApiKey;
}
get mapboxStyle() {
var _a;
return (_a = this.config) === null || _a === void 0 ? void 0 : _a.mapboxStyle;
}
}
exports.VisualizationConfiguration = VisualizationConfiguration;
//# sourceMappingURL=visualization-configuration.js.map
export declare type ChartType = 'COLUMN';
export declare type VisualizationType = ChartType | 'CHART' | 'TABLE' | 'MAP' | 'DICTIONARY';
export declare type VisualizationType = ChartType | 'CHART' | 'REPORT_TABLE' | 'MAP' | 'DICTIONARY' | 'MAPBOX';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc