npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@_kwh50/discovery-highcharts

v1.5.3

Published

Link between Senx Discovery and Highcharts

Downloads

1,276

Readme

Discovery - Highcharts

Produce by Kwh50

Overview

This plugin allows seamless integration between Discovery, a powerful tool distributed by SenX, and Highcharts, a popular JavaScript charting library. With this plugin, users can visualize data from Discovery dashboards directly in Highcharts, enabling rich and interactive data visualization capabilities.

⚠️ Warning: If you want to use this plugin for commercial purposes, you need to purchase a license here

Table of Contents

Installation

To install the plugin, run this command in your project:

npm install @_kwh50/discovery-highcharts highcharts

Getting Started

To use this plugin you have to import it in your page

  • In HTML
    <script src="https://unpkg.com/@_kwh50/[email protected]/dist/discovery-highcharts/discovery-highcharts.esm.js" />
  • In Typescript
import "@_kwh50/discovery-highcharts";

Usage

To implement a Highcharts chart inside a Discovery dashboard, you need to specify the type of the tile :

'type' 'HC'

Then, you can pass your Highcharts chart definition in the options field. :

  • HTML
<discovery-dashboard url="https://warpcloud.senx.io/api/v0/exec" dashboard-title="Discovery - Highcharts" debug id="dash">
    Discovery definition here
</discovery-dashboard>
<script>
    // Set HCOptions which correspond to Highcharts options
    document.getElementById('dash').setAttribute('options', JSON.stringify({
        HCParams: //Your Highcharts chart definition here
    }));
    </script>
  • React
<discovery-dashboard url="https://warpcloud.senx.io/api/v0/exec" dashboard-title="Discovery - Highcharts">
    {`{
        'title' 'Discovery - Highcharts'
        'description' 'Discovery dashboard using Highcharts'
        'tiles' [
            {
                'title' 'Highcharts graph'
                'x' 0 'y' 0 'w' 12 'h' 3
                'type' 'HC'
                'options' {
                    'HCParams' `${Your Highcharts chart definition here}`
                }
                'macro' <%
                    1 4 <% DROP 
                    NEWGTS 'g' STORE
                    1 10 <% 
                        'ts' STORE $g $ts RAND + STU * NOW + NaN NaN NaN RAND ADDVALUE DROP
                    %> FOR
                $g %> FOR STACKTOLIST 'data' STORE
                { 
                    'data' $data 
                }
                %>
            }
        ]
    }`}
</discovery-dashboard>

Examples

Here you can see an exemple in pure HTML and in React :

  • HTML
<!DOCTYPE html>
<html dir="ltr" lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0" />
    <title>Stencil Component Starter</title>

    <!-- Import Discovery -->
    <script nomodule src="https://unpkg.com/@senx/discovery-widgets/dist/discovery/discovery.js"></script>
    <script type="module" src="https://unpkg.com/@senx/discovery-widgets/dist/discovery/discovery.esm.js"></script>

    <script type="module" src="/build/kwh50-discovery-highcharts.esm.js"></script>
    <script nomodule src="/build/kwh50-discovery-highcharts.js"></script>
  </head>
  <body>
    <discovery-dashboard url="https://warpcloud.senx.io/api/v0/exec" dashboard-title="Discovery - Highcharts" debug id="dash">
      {
          'title' 'Discovery - Highcharts'
          'description' 'Discovery dashboard using Highcharts'
          'tiles' [
              {
                  'title' 'Highcharts graph'
                  'x' 0 'y' 0 'w' 12 'h' 3
                  'type' 'HC'
                  'macro' <%
                      1 4 <% DROP 
                      NEWGTS 'g' STORE
                      1 10 <% 
                      'ts' STORE $g $ts RAND + STU * NOW + NaN NaN NaN RAND ADDVALUE DROP 
                      %> FOR
                      $g %> FOR STACKTOLIST 'data' STORE
                      { 
                          'data' $data 
                      }
                  %>
              }
          ]
      }
      </discovery-dashboard>
      <script>
        // Set HCOptions which correspond to Highcharts options
        document.getElementById('dash').setAttribute('options', JSON.stringify({
          HCOptions: {
            chart: {
              type: 'area',
              animation: false,
            },
            legend: {
              enabled: true,
            },
            rangeSelector: {
              enabled: false
            },
            xAxis: {
              type: 'datetime',
              title: {
                text: 'Time',
              },
            },
            yAxis: {
              title: {
                text: 'Value',
              },
            },
            series: [
              {
              type: 'line',
              name: 'My custom serie',
            },
            {
              type: 'line',
              name: 'My other custom serie',
            },
            {
              type: 'line',
              name: 'An other one',
            },
            {
              type: 'line',
              name: 'And again...',
            }
          ],
          },
        })
      );
      </script>
  </body>
</html>
  • React
import React from 'react';
import "@senx/discovery-widgets/dist/discovery/discovery.esm.js";
import "@_kwh50/discovery-highcharts";
import "highcharts/highstock";

//declare the html tag discovery-dashboard
declare global {
    namespace JSX {
        interface IntrinsicElements {
            "discovery-dashboard": any;
        }
    }
}

function App() {

    return (
        <div className="App">
            <discovery-dashboard
                url="https://warpcloud.senx.io/api/v0/exec"
                dashboard-title="Discovery - Highcharts"
            >
                {`{
                    'title' 'Discovery - Highcharts'
                    'description' 'Discovery dashboard using Highcharts'
                    'tiles' [
                        {
                            'title' 'Highcharts graph'
                            'x' 0 'y' 0 'w' 12 'h' 3
                            'type' 'HC'
                            'options' {
                                'HCParams' '${JSON.stringify({
                                    chart: {
                                        type: "area",
                                        animation: false,
                                    },
                                    legend: {
                                        enabled: true,
                                    },
                                    rangeSelector: {
                                        enabled: false,
                                    },
                                    xAxis: {
                                        type: "datetime",
                                        title: {
                                            text: "Time",
                                        },
                                    },
                                    yAxis: {
                                        title: {
                                            text: "Value",
                                        },
                                    },
                                    series: [
                                        {
                                            type: "line",
                                            name: "My custom serie",
                                        },
                                        {
                                            type: "line",
                                            name: "My other custom serie",
                                        },
                                        {
                                            type: "line",
                                            name: "An other one",
                                        },
                                        {
                                            type: "line",
                                            name: "And again...",
                                        },
                                    ],
                                } as Highcharts.Options)}'
                            }
                            'macro' <%
                                1 4 <% DROP 
                                NEWGTS 'g' STORE
                                1 10 <% 
                                'ts' STORE $g $ts RAND + STU * NOW + NaN NaN NaN RAND ADDVALUE DROP 
                                %> FOR
                                $g %> FOR STACKTOLIST 'data' STORE
                                { 
                                    'data' $data 
                                }
                            %>
                        }
                    ]
                }`}
            </discovery-dashboard>
        </div>
    );
}

export default App;

License

License powered by LGPL