new(basic.gblib): CHART keyword dev started.

This commit is contained in:
Rodrigo Rodriguez 2022-06-03 07:43:20 -03:00
parent 4e86f08473
commit b500a366b0
4 changed files with 2548 additions and 88 deletions

2570
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -77,8 +77,10 @@
"botbuilder-dialogs": "4.11.0", "botbuilder-dialogs": "4.11.0",
"botframework-connector": "4.11.0", "botframework-connector": "4.11.0",
"botlib": "1.10.1", "botlib": "1.10.1",
"c3-chart-maker": "^0.2.8",
"cli-spinner": "0.2.10", "cli-spinner": "0.2.10",
"core-js": "3.14.0", "core-js": "3.14.0",
"data-forge": "^1.9.5",
"date-diff": "0.2.2", "date-diff": "0.2.2",
"dotenv-extended": "2.9.0", "dotenv-extended": "2.9.0",
"exceljs": "4.2.1", "exceljs": "4.2.1",

View file

@ -47,6 +47,7 @@ import * as fs from 'fs';
const DateDiff = require('date-diff'); const DateDiff = require('date-diff');
const puppeteer = require('puppeteer'); const puppeteer = require('puppeteer');
const Path = require('path'); const Path = require('path');
const c3ChartMaker = require('c3-chart-maker');
/** /**
* Base services of conversation to be called by BASIC which * Base services of conversation to be called by BASIC which
@ -122,6 +123,67 @@ export class DialogKeywords {
return page; return page;
} }
/**
*
* https://c3js.org/examples.html
*
* @param data
* @param legends
* @see https://www.npmjs.com/package/plot
*/
public async getChart(data, legends)
{
const chartDefinition = {
"size": {
"height": 600,
"width": 1200
},
"series": {
"x": "Date",
"Close": "Close",
"Volume": "Volume"
},
"data": {
"x": "x",
"type": "line",
"axes": {
"Volume": "y2"
},
"types": {
"Volume": "bar"
}
},
"axis": {
"x": {
"type": "timeseries",
"tick": {
"format": "%Y-%m-%d"
}
},
"y": {
"label": {
"text": "Close",
"position": "outer-middle"
}
},
"y2": {
"show": true,
"label": {
"text": "Signal",
"position": "outer-middle"
}
}
},
"transition": {
"duration": 0
}
};
const outputFilePath = "output.png";
await c3ChartMaker(data, chartDefinition, outputFilePath);
}
/** /**
* Find element on page DOM. * Find element on page DOM.
* *

View file

@ -440,7 +440,7 @@ export class SystemKeywords {
* row = rows[i] * row = rows[i]
* send sms to "+" + row.mobile, "Hello " + row.name + "! " * send sms to "+" + row.mobile, "Hello " + row.name + "! "
* loop * loop
* * @see NPM package data-forge
*/ */
public async find(file: string, ...args): Promise<any> { public async find(file: string, ...args): Promise<any> {
GBLog.info(`BASIC: FIND running on ${file} and args: ${JSON.stringify(args)}...`); GBLog.info(`BASIC: FIND running on ${file} and args: ${JSON.stringify(args)}...`);