All Projects → ecomfe → Echarts Liquidfill

ecomfe / Echarts Liquidfill

Licence: bsd-3-clause
Liquid Fill Chart for Apache ECharts (incubating)

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Echarts Liquidfill

Go Echarts
🎨 The adorable charts library for Golang
Stars: ✭ 4,255 (+387.96%)
Mutual labels:  echarts
Antd Umi Sys
企业BI系统,数据可视化平台,主要技术:react、antd、umi、dva、es6、less等,与君共勉,互相学习,如果喜欢请start ⭐。
Stars: ✭ 503 (-42.32%)
Mutual labels:  echarts
Tuchart
Tuchart is a visualization interface for the Chinese stock market. Tuchart supports candlestick charts, price charts, tick data, high-frequency data and distribution of top shareholders for individual stocks. Tuchart是一个基于pyqt和echarts的股票视觉化应用。Tuchart 支持日/月线,分笔,高频数据,前十股东分笔的视觉化
Stars: ✭ 694 (-20.41%)
Mutual labels:  echarts
X Chart
🚀 x-chart is a draggable & resizable data visualization system
Stars: ✭ 386 (-55.73%)
Mutual labels:  echarts
Ant Admin
基于 antd 的后台管理平台, 在 react 中玩转 D3.js
Stars: ✭ 455 (-47.82%)
Mutual labels:  echarts
Echarts For Weixin
Apache ECharts (incubating) 的微信小程序版本
Stars: ✭ 5,479 (+528.33%)
Mutual labels:  echarts
His
HIS英文全称 hospital information system(医院信息系统http://59.110.234.89:9999/swagger-ui.html ),医疗信息就诊系统,系统主要功能按照数据流量、流向及处理过程分为临床诊疗、药品管理、财务管理、患者管理。诊疗活动由各工作站配合完成,并将临床信息进行整理、处理、汇总、统计、分析等。本系统包括以下工作站:门诊医生工作站、药房医生工作站、医技医生工作站、收费员工作站、对帐员工作站、管理员工作站。需求为东软提供的云医院。
Stars: ✭ 359 (-58.83%)
Mutual labels:  echarts
Leaflet.flowecharts
leaflet plugin for Baidu Echarts
Stars: ✭ 17 (-98.05%)
Mutual labels:  echarts
Blog.admin
✨ 基于vue 的管理后台,配合Blog.Core与Blog.Vue等多个项目使用
Stars: ✭ 500 (-42.66%)
Mutual labels:  echarts
City Vein
Urban structure characterized by 🚌 public lines
Stars: ✭ 644 (-26.15%)
Mutual labels:  echarts
Flutter echarts
A Flutter widget to use Apache ECharts (incubating) in a reactive way.
Stars: ✭ 420 (-51.83%)
Mutual labels:  echarts
Javamonitor
Java应用性能远程监控系统(使用C/S架构)适用于监控所有Java应用,具有堆内存监控、方法区监控、GC监控、类加载监控、类编译监控与线程监控,提供堆快照下载,线程快照下载
Stars: ✭ 428 (-50.92%)
Mutual labels:  echarts
Jimureport
积木报表,是一款免费的企业级低代码报表!类似于excel操作风格,在线拖拽完成报表设计!功能涵盖: 报表设计、图形报表、打印设计、大屏设计等,永久免费!领先的企业级Web报表软件,采用纯Web在线技术,专注于解决企业报表快速制作难题。
Stars: ✭ 598 (-31.42%)
Mutual labels:  echarts
Echarts4r
🐳 ECharts 5 for R
Stars: ✭ 378 (-56.65%)
Mutual labels:  echarts
V Charts
基于 Vue2.0 和 ECharts 封装的图表组件📈📊
Stars: ✭ 6,513 (+646.9%)
Mutual labels:  echarts
Angular Echarts
💹 angularjs bindings for baidu echarts
Stars: ✭ 367 (-57.91%)
Mutual labels:  echarts
Stresstestplatform
基于Jmeter实现的在线压测和管理Jmx的平台。
Stars: ✭ 515 (-40.94%)
Mutual labels:  echarts
Echarts Wordcloud
Apache ECharts (incubating) wordcloud extension based on wordcloud2.js
Stars: ✭ 928 (+6.42%)
Mutual labels:  echarts
Ngx Echarts
An angular (ver >= 2.x) directive for ECharts (ver >= 3.x)
Stars: ✭ 820 (-5.96%)
Mutual labels:  echarts
Istock
👉一个基于spring boot 实现的java股票爬虫(仅支持A股),如果你❤️请⭐️ . V2升级版正在开发中!
Stars: ✭ 622 (-28.67%)
Mutual labels:  echarts

Liquid Fill Chart

Liquid Fill Chart plugin for Apache ECharts, which is usually used to represent data in percentage.

Rendering Results

Install ECharts

To use ECharts plugins, you need to include the plugin JavaScript file after ECharts file.

<script src='echarts.js'></script>
<script src='echarts-liquidfill.js'></script>

ECharts can be downloaded at GitHub dist directory or Download page of Official Website (in Chinese).

NOTE

The minimum package of ECharts required by LiquidFill Chart is simple version on GitHub, or selecting nothing in online builder (in Chinese). If you need other chart types or components in your other chart, you should include them accordingly.

Install echarts-liquidfill with npm

# install echarts as peer dependency
npm install echarts
npm install echarts-liquidfill

NOTE:

[email protected] is compitable with [email protected] [email protected] is compitable with [email protected]

Download echarts-liquidfill from GitHub

You may download the lastest ECharts files on ECharts official site and download this plugin in dist directory.

Note that if you need tooltip for Liquid Fill Chart, you need the complete ECharts version. Otherwise, the simple version will be competent.

Important Notes

Omitted normal

Since ECharts v4.0.0, normal is no longer needed for itemStyle or label.

Flatten textStyle

Since ECharts v3.7.0, textStyle option is flatten, so that series.label[normal|emphasis].textStyle.xxx is now can be written in series.label[normal|emphasis].textStyle. This is supported from echarts-liquidfill v1.0.6. So if you found examples with textStyle in old demo, don't be too surprised.

Quick Start

Here are some common uses:

To ask a question, you may fork Liquid Fill Chart Example on Gallery and copy your code there. Then you may open an issue in this project.

Examples

A Simple Example

To create a Liquid Fill Chart, you need to have a series with type of 'liquidFill'. A basic option may be:

var option = {
    series: [{
        type: 'liquidFill',
        data: [0.6]
    }]
};

A simple liquid fill chart

Run

Multiple Waves

It is easy to create a liquid fill chart will multiple waves, either to represent multiple data, or to improve the visual effect of the chart.

var option = {
    series: [{
        type: 'liquidFill',
        data: [0.6, 0.5, 0.4, 0.3]
    }]
};

This creates a chart wit waves at position of 60%, 50%, 40%, and 30%.

Multiple waves

Run

Color and Opacity

To set colors for liquid fill chart series, set color to be an array of colors. To set opacity, use itemStyle.opacity and itemStyle.emphasis.opacity for normal style and hover style.

var option = {
    series: [{
        type: 'liquidFill',
        data: [0.5, 0.4, 0.3],
        color: ['red', '#0f0', 'rgb(0, 0, 255)'],
        itemStyle: {
                opacity: 0.6
        },
        emphasis: {
            itemStyle: {
                opacity: 0.9
            }
        }
    }]
};

Color and opacity

Run

You may also set the color and opacity of a single data item by:

var option = {
    series: [{
        type: 'liquidFill',
        data: [0.5, 0.4, {
            value: 0.3,
            itemStyle: {
                color: 'red',
                opacity: 0.6
            },
            emphasis: {
                itemStyle: {
                    opacity: 0.9
                }
            }
        }]
    }]
};

Color and opacity of a single data item

Run

Static Waves

To provent the waves from moving left or right, you may simply set waveAnimation to be false. To disable the animation of waves raising, set animationDuration and animationDurationUpdate to be 0.

var option = {
    series: [{
        type: 'liquidFill',
        waveAnimation: false,
        animationDuration: 0,
        animationDurationUpdate: 0,
        data: [0.6, 0.5, 0.4, 0.3]
    }]
};

Static waves

Run

Still Water

You may set the amplitude to be 0 to make still waves.

var option = {
    series: [{
        type: 'liquidFill',
        data: [0.6, 0.5, 0.4, 0.3],
        amplitude: 0,
        waveAnimation: 0
    }]
};

It is recommended to set waveAnimation to be false in this case to disable animation for performance consideration.

Still water

Run

Change A Single Wave

To change a single wave, overwrite the options in data item.

var option = {
    series: [{
        type: 'liquidFill',
        data: [0.6, {
            value: 0.5,
            direction: 'left',
            itemStyle: {
                color: 'red'
            }
        }, 0.4, 0.3]
    }]
};

Change a single wave

Run

Background Style

You can use backgroundStyle option to set the stroke, fill style of background shape.

var option = {
    series: [{
        type: 'liquidFill',
        data: [0.6, 0.5, 0.4, 0.3],
        backgroundStyle: {
            borderWidth: 5,
            borderColor: 'red',
            color: 'yellow'
        }
    }]
};

Change border width and color

Run

Outline Style

To hide the outline, just set outline.show to be false.

var option = {
    series: [{
        type: 'liquidFill',
        data: [0.6, 0.5, 0.4, 0.3],
        outline: {
            show: false
        }
    }]
};

No outline

Run

Shape

Shape of water fill chart. It can be:

  • one of the default symbols: 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow';
  • 'container': a shape that fully fills the container.
  • an SVG path starting with 'path://'.
var options = [{
    series: [{
        type: 'liquidFill',
        data: [0.6, 0.5, 0.4, 0.3],
        shape: 'diamond'
    }]
}];

Diamond wave

Run

option = {
    series: [{
        type: 'liquidFill',
        data: [0.5, 0.4, 0.3, 0.2],
        shape: 'container',
        outline: {
            show: false
        }
    }]
};

Fill the container

Run

var option = {
    series: [{
        type: 'liquidFill',
        data: [0.6, 0.55, 0.4, 0.25],
        radius: '60%',
        outline: {
            show: false
        },
        backgroundStyle: {
            borderColor: '#156ACF',
            borderWidth: 1,
            shadowColor: 'rgba(0, 0, 0, 0.4)',
            shadowBlur: 20
        },
        shape: 'path://M367.855,428.202c-3.674-1.385-7.452-1.966-11.146-1.794c0.659-2.922,0.844-5.85,0.58-8.719 c-0.937-10.407-7.663-19.864-18.063-23.834c-10.697-4.043-22.298-1.168-29.902,6.403c3.015,0.026,6.074,0.594,9.035,1.728 c13.626,5.151,20.465,20.379,15.32,34.004c-1.905,5.02-5.177,9.115-9.22,12.05c-6.951,4.992-16.19,6.536-24.777,3.271 c-13.625-5.137-20.471-20.371-15.32-34.004c0.673-1.768,1.523-3.423,2.526-4.992h-0.014c0,0,0,0,0,0.014 c4.386-6.853,8.145-14.279,11.146-22.187c23.294-61.505-7.689-130.278-69.215-153.579c-61.532-23.293-130.279,7.69-153.579,69.202 c-6.371,16.785-8.679,34.097-7.426,50.901c0.026,0.554,0.079,1.121,0.132,1.688c4.973,57.107,41.767,109.148,98.945,130.793 c58.162,22.008,121.303,6.529,162.839-34.465c7.103-6.893,17.826-9.444,27.679-5.719c11.858,4.491,18.565,16.6,16.719,28.643 c4.438-3.126,8.033-7.564,10.117-13.045C389.751,449.992,382.411,433.709,367.855,428.202z',
        label: {
            position: ['38%', '40%'],
            formatter: function() {
                return 'ECharts\nLiquid Fill';
            },
            fontSize: 40,
            color: '#D94854'
        }
    }]
};

ECharts Liquid Fill

Run

Animation

Generally speaking, there are two types of animations in liquid fill charts.

The first type is initial animation, which has the effect of wave raising. The easing method of this animation is controlled with animationEasing and its duration with animationDuration.

The second type is the update animation, which is usually used when data changes and wave height changes. They are controlled with animationEasingUpdate and animationDurationUpdate.

For example, to disable the raising animation and set update animation time to be two seconds with cubicOut easing, you can use the following option:

var option = {
    series: [{
        type: 'liquidFill',
        data: [0.6, 0.5, 0.4, 0.3],
        animationDuration: 0,
        animationDurationUpdate: 2000,
        animationEasingUpdate: 'cubicOut'
    }]
};
chart.setOption(option);
setTimeout(function () {
    chart.setOption({
        series: [{
            type: 'liquidFill',
            data: [0.8, 0.6, 0.4, 0.2]
        }]
    })
}, 3000);

Update animation

Run

Change Text

By default, the text label of liquid fill chart displays percentage of the first data. For example, for a chart with data [0.6, 0.5, 0.4, 0.3], default text is 60%.

To change the text, you may use label.formatter, which can be set to a string or function.

If it is a string, {a} refers to series name, {b} to data name, and {c} to data value.

var option = {
    series: [{
        type: 'liquidFill',
        name: 'Liquid Fill',
        data: [{
            name: 'First Data',
            value: 0.6
        }, 0.5, 0.4, 0.3],
        label: {
            formatter: '{a}\n{b}\nValue: {c}',
            fontSize: 28
        }
    }]
};

Label text of this example is 'Liquid Fill\nFirst Data\nValue: 0.6'.

Label formatter as string

Run

This has the same result as using formatter as a function:

var option = {
    series: [{
        type: 'liquidFill',
        name: 'Liquid Fill',
        data: [{
            name: 'First Data',
            value: 0.6
        }, 0.5, 0.4, 0.3],
        label: {
            formatter: function(param) {
                return param.seriesName + '\n'
                    + param.name + '\n'
                    + 'Value:' + param.value;
            },
            fontSize: 28
        }
    }]
};

Run

Text position is at the center by default. label.position can be set to be 'inside', 'left', 'right', 'top', 'bottom', or horizontal and vertical positions like ['10%', '20%'], which means '10%' to the left (controlled by label.align, which can be 'left', 'center', or 'right') and '20%' to the top (controlled by label.baseline, which can be 'top', 'middle', or 'bottom').

Shadow

By default, waves and outline have shadow on them. Here's how to change them.

var option = {
    series: [{
        type: 'liquidFill',
        data: [0.6, 0.5, 0.4, 0.3],
        itemStyle: {
            shadowBlur: 0
        },
        outline: {
            borderDistance: 0,
            itemStyle: {
                borderWidth: 5,
                borderColor: '#156ACF',
                shadowBlur: 20,
                shadowColor: 'rgba(255, 0, 0, 1)'
            }
        }
    }]
};

Change shadow

Run

Tooltip

To add tooltip:

var option = {
    series: [{
        type: 'liquidFill',
        data: [0.6],
        name: 'Liquid Fill'
    }],
    tooltip: {
        show: true
    }
};

Tooltip

Run

Click Event

To add click event on waves:

chart.setOption(option);
chart.on('click', function() {
    console.log(arguments);
    // do something useful here
});

Like any other chart types, the above code will only trigger events on waves. If you want to track events on the whole canvas or specific elements, you may add listener to zrender like:

chart.getZr().on('click', function() {
       console.log(arguments);
});

Non-interactable

To make an element (e.g., a wave) non-interactable, simply set silent to be true.

var option = {
    series: [{
        type: 'liquidFill',
        data: [0.6, 0.5, 0.4, 0.3],
        silent: true
    }]
};

Run

API

Default option for liquid fill charts are:

{
    data: [],

    color: ['#294D99', '#156ACF', '#1598ED', '#45BDFF'],
    center: ['50%', '50%'],
    radius: '50%',
    amplitude: '8%',
    waveLength: '80%',
    phase: 'auto',
    period: 'auto',
    direction: 'right',
    shape: 'circle',

    waveAnimation: true,
    animationEasing: 'linear',
    animationEasingUpdate: 'linear',
    animationDuration: 2000,
    animationDurationUpdate: 1000,

    outline: {
        show: true,
        borderDistance: 8,
        itemStyle: {
            color: 'none',
            borderColor: '#294D99',
            borderWidth: 8,
            shadowBlur: 20,
            shadowColor: 'rgba(0, 0, 0, 0.25)'
        }
    },

    backgroundStyle: {
        color: '#E3F7FF'
    },

    itemStyle: {
        opacity: 0.95,
        shadowBlur: 50,
        shadowColor: 'rgba(0, 0, 0, 0.4)'
    },

    label: {
        show: true,
        color: '#294D99',
        insideColor: '#fff',
        fontSize: 50,
        fontWeight: 'bold',

        align: 'center',
        baseline: 'middle'
        position: 'inside'
    },

    emphasis: {
        itemStyle: {
            opacity: 0.8
        }
    }
}

data {(number|Object)[]}

Value of each data item should be between 0 and 1.

The data item can also be an object to configure the option for a single item.

var option = {
    series: [{
        type: 'liquidFill',
        data: [0.6, {
            value: 0.5,
            itemStyle: {
                color: 'red'
            }
        }, 0.4, 0.3]
    }]
};

This defines a chart with the second wave of red color.

color {string[]}

Wave colors.

shape {string}

Shape of water fill chart. It can be one of the default symbols: 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow'. Or, an SVG path starting with 'path://'.

center {string[]}

Position of the chart. The first value is x position, the second one is the y position. Each of the values can be a relative value like '50%', which is relative to the smaller value of container width and height, or an absolute value like 100px.

radius {string}

Radius of the chart, which can be a relative value like '50%', which is relative to the smaller value of container width and height, or an absolute value like 100px.

amplitude {number}

Amplitude of the wave, in pixels or percentage. If it is in percentage, it's relative to the diameter.

waveLength {string|number}

Wave length of the wave, which can be a relative value like '50%', which is relative to the diameter, or an absolute value like '100px' or 100.

phase {number}

Phase of wave, in radian system. By default, it is set to be 'auto', when each wave has a phase of Math.PI / 4 larger than the previous one.

period {number|'auto'|function}

Milliseconds that it takes to move forward a wave-length. By default, it is set to be 'auto', when the wave at the front has a greater speed.

It can also be a formatter function.

var option = {
    series: [{
        type: 'liquidFill',
        data: [0.6, 0.5, 0.4, 0.3],
        radius: '70%',
        phase: 0,
        period: function (value, index) {
            // This function is called four times, each for a data item in series.
            // `value` is 0.6, 0.5, 0.4, 0.3, and `index` is 0, 1, 2, 3.
            return 2000 * index + 1000;
        }
    }]
}

direction {string}

Direction that the waves moving in, which should either be 'right', or 'left'.

waveAnimation {boolean}

Whether to enable wave from moving left or right.

animationEasing {string}

Easing methods for initial animation, when waves raise from the bottom at the beginning.

animationEasingUpdate {string}

Easing methods for other animation, for example, when data value changes and wave position changes.

animationDuration {number}

Initial animation duration, in milliseconds.

animationDurationUpdate {number}

Other animation duration, in milliseconds.

outline.show {boolean}

Whether to display outline.

outline.borderDistance {number}

Distance between border and inner circle.

outline.itemStyle.borderColor {string}

Border color.

outline.itemStyle.borderWidth {number}

Border width.

outline.itemStyle.shadowBlur {number}

Outline shadow blur size.

outline.itemStyle.shadowColor {string}

Outline shadow color.

backgroundStyle.color {string}

Background fill color.

backgroundStyle.borderWidth {string}

Background stroke line width.

backgroundStyle.borderColor {string}

Background stroke line width.

backgroundStyle.itemStyle.shadowBlur {number}

Background shadow blur size.

backgroundStyle.itemStyle.shadowColor {string}

Background shadow color.

backgroundStyle.itemStyle.opacity {number}

Background opacity.

itemStyle.opacity {number}

Wave opacity.

itemStyle.shadowBlur {number}

Wave shadow width.

itemStyle.shadowColor {string}

Wave shadow color.

emphasis.itemStyle.opacity {number}

Wave opacity when hover.

label.show {boolean}

Whether to display label text.

label.color {string}

Color of text when display on background.

label.insideColor {string}

Color of text when display on wave.

label.fontSize {number}

Label font size.

label.fontWeight {string}

Label font weight.

label.align {string}

Text align, which should be 'left', 'center', or 'right'.

label.baseline {string}

Text vertical align, which should be 'top', 'middle', or 'bottom'.

label.position {string|string[]}

Text position is at the center by default. label.position can be set to be 'inside', 'left', 'right', 'top', 'bottom', or horizontal and vertical positions like ['10%', '20%'], which means '10%' to the left and '20%' to the top.

Build

For development:

$ webpack

For release:

$ webpack -p
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].