Skip to content

Commit

Permalink
Fixed and improvements based on review ioBroker/ioBroker.repositories…
Browse files Browse the repository at this point in the history
  • Loading branch information
MyHomeMyData committed Sep 2, 2024
1 parent 2dcbe72 commit 6d1fdaf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 71 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [18.x, 20.x]
os: [ubuntu-latest, windows-latest]
node-version: [18.x, 20.x, 22.x]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: ioBroker/testing-action-adapter@v1
Expand Down
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Basic concept
There are several adapters available to view charts within ioBroker. As far as I know, all of them are using a UI to configure content and options of the charts. Typically not all features of the used graphical sub system could be used in this way. E.g. it's not possible to view fully featured stacked charts with eChart-Adapter.

This adapter uses a different approach. It brings the complete feature set of [Apache eCharts](https://echarts.apache.org/en/index.html) to ioBroker. Take a look the [demo charts](https://echarts.apache.org/examples/en/index.html).
This adapter uses a different approach. It brings the complete feature set of [Apache ECharts](https://echarts.apache.org/en/index.html) to ioBroker. Take a look the [demo charts](https://echarts.apache.org/examples/en/index.html).

**There is no UI to configure any chart.** You have to define the chart yourself, the adapter takes care about visualization. You have to provide definition and content of the chart by providing the content as a json-object - in eCharts examples it corresponds to the content of variable `option`. Here's an example to make it clear. To create a stacked chart you store it's definition in an ioBroker state (json format):

Expand Down Expand Up @@ -52,14 +52,6 @@ But if you have a very specific idea in mind for a more complex chart, flexchart

# Getting started

### Install flexchart adapter

Presently the adapter is availabe at Github only. Best way for installation is via command line interface:
```
iob url https://github.com/MyHomeMyData/ioBroker.flexcharts.git
```
Now add an instance in ioBroker GUI. The only configuration parameter of the adapter is the port number. You may use the default value of 3100 (used in examples shown here).

### Using the adapter

Wenn adapter is running you can access it via http://localhost:3100/echarts.html (replace `localhost` by address of your ioBroker server).
Expand Down Expand Up @@ -175,3 +167,6 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Additional remark:
Source code of [Apache ECharts](https://echarts.apache.org/en/index.html) is used according to [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)
9 changes: 5 additions & 4 deletions io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"zh-cn": "初步释放"
}
},
"title": "Fully featured eCharts",
"titleLang": {
"en": "Fully featured eCharts",
"de": "Alle Möglichkeiten von eCharts nutzen",
Expand Down Expand Up @@ -61,15 +60,16 @@
"MyHomeMyData <juergen.bonfert@gmail.com>"
],
"keywords": [
"ioBroker",
"visualization",
"chart",
"charts",
"echarts"
],
"license": "MIT",
"licenseInformation": {
"license": "MIT",
"type": "free"
},
"platform": "Javascript/Node.js",
"main": "main.js",
"icon": "flexcharts-icon.png",
"enabled": true,
"extIcon": "https://raw.githubusercontent.com/MyHomeMyData/ioBroker.flexcharts/main/admin/flexcharts-icon.png",
Expand All @@ -78,6 +78,7 @@
"mode": "daemon",
"messagebox": true,
"type": "visualization-widgets",
"tier": 3,
"compact": true,
"connectionType": "local",
"dataSource": "assumption",
Expand Down
56 changes: 0 additions & 56 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,13 @@ class Flexcharts extends utils.Adapter {
this.webServer = null;

this.on('ready', this.onReady.bind(this));
this.on('stateChange', this.onStateChange.bind(this));
// this.on('objectChange', this.onObjectChange.bind(this));
// this.on('message', this.onMessage.bind(this));
this.on('unload', this.onUnload.bind(this));
}

/**
* Is called when databases are connected and adapter received configuration.
*/
async onReady() {
// Initialize your adapter here

// Reset the connection indicator during startup
this.setState('info.connection', false, true);

Expand Down Expand Up @@ -348,57 +343,6 @@ class Flexcharts extends utils.Adapter {

}
}

// If you need to react to object changes, uncomment the following block and the corresponding line in the constructor.
// You also need to subscribe to the objects with `this.subscribeObjects`, similar to `this.subscribeStates`.
// /**
// * Is called if a subscribed object changes
// * @param {string} id
// * @param {ioBroker.Object | null | undefined} obj
// */
// onObjectChange(id, obj) {
// if (obj) {
// // The object was changed
// this.log.info(`object ${id} changed: ${JSON.stringify(obj)}`);
// } else {
// // The object was deleted
// this.log.info(`object ${id} deleted`);
// }
// }

/**
* Is called if a subscribed state changes
* @param {string} id
* @param {ioBroker.State | null | undefined} state
*/
onStateChange(id, state) {
if (state) {
// The state was changed
this.log.info(`state ${id} changed: ${state.val} (ack = ${state.ack})`);
} else {
// The state was deleted
this.log.info(`state ${id} deleted`);
}
}

// If you need to accept messages in your adapter, uncomment the following block and the corresponding line in the constructor.
// /**
// * Some message was sent to this instance over message box. Used by email, pushover, text2speech, ...
// * Using this method requires "common.messagebox" property to be set to true in io-package.json
// * @param {ioBroker.Message} obj
// */
// onMessage(obj) {
// if (typeof obj === 'object' && obj.message) {
// if (obj.command === 'send') {
// // e.g. send email or pushover or whatever
// this.log.info('send command');

// // Send response in callback if required
// if (obj.callback) this.sendTo(obj.from, obj.command, 'Message received', obj.callback);
// }
// }
// }

}

if (require.main !== module) {
Expand Down

0 comments on commit 6d1fdaf

Please sign in to comment.