柱状图

HighChart 不同颜色(柱状图)

北战南征 提交于 2019-11-29 23:55:26
var chart = new Highcharts.Chart({ chart: { plotBackgroundColor: null, plotBorderWidth: null, backgroundColor: "transparent", plotShadow: false, renderTo: 'CMForNetWidthInCmts' }, colors:["#434348", "#3398db", "#90ed7d", "#f7a35c", "#61a0a8", "#61a0a8", "#91c7ae", "#2f4554"], title: { // text: PORTAL.Translate.cmts_table_AllNetCMTypeCount text: "" }, tooltip: { pointFormat: '{series.name}: <b>{point.y}</b>' }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: true, color: '#000000', connectorColor: '#000000', format: '<b>{point.name}</b>: {point.y} (

Leetcode 84.柱状图中最大的矩形

点点圈 提交于 2019-11-29 13:43:08
Leetcode 84.柱状图中最大的矩形 题目描述: 给定 n 个非负整数,用来表示柱状图中各个柱子的高度。每个柱子彼此相邻,且宽度为 1 。 求在该柱状图中,能够勾勒出来的矩形的最大面积。 以上是柱状图的示例,其中每个柱子的宽度为 1,给定的高度为 [2,1,5,6,2,3]。 图中阴影部分为所能勾勒出的最大矩形面积,其面积为 10 个单位。 示例: 输入: [2,1,5,6,2,3] 输出: 10 来源:力扣(LeetCode) 链接: https://leetcode-cn.com/problems/largest-rectangle-in-histogram 单调栈: 我们可以看到,直方图矩形面积要最大的话,需要尽可能的使得连续的矩形多,并且最低一块的高度要高。有点像木桶原理一样,总是最低的那块板子决定桶的装水量。 那么既然需要用单调栈来做,首先要考虑到底用递增栈,还是用递减栈来做。我们想啊,递增栈是维护递增的顺序,当遇到小于栈顶元素的数就开始处理,而递减栈正好相反,维护递减的顺序,当遇到大于栈顶元素的数开始处理。那么根据这道题的特点,我们需要按从高板子到低板子的顺序处理,先处理最高的板子,宽度为1,然后再处理旁边矮一些的板子,此时长度为2,因为之前的高板子可组成矮板子的矩形 ,因此我们需要一个递增栈,当遇到大的数字直接进栈,而当遇到小于栈顶元素的数字时

d3.js 教程 模仿echarts柱状图

孤街浪徒 提交于 2019-11-29 05:03:58
由于最近工作不是很忙,隧由把之前的charts项目用d3.js重写的一下,其实d3.js文档很多,但是入门不是很难,可是想真的能做一个完成的,交互良好的图还是要下一番功夫的。今天在echarts找到了一个 柱状图 ,如图。 模仿了一番,废话不多说。下面就开始我们的代码(注意是D3.v4版本)。 1. js 类 class Bar { constructor() { this._width = 1000; this._height = 700; this._padding = 10; this._offset = 35; this._margins = {right: 40,bottom: 40,left: 40,top: 40}; this._scaleX = d3.scaleBand().rangeRound([0, this._width - this._margins.left - this._margins.right]); this._scaleY = d3.scaleLinear().range([this._height - this._margins.top - this._margins.bottom, 0]); this._color = '#3398DB'; this._data = []; this._svg = null; this._body =

echarts之--柱状图-%显示

白昼怎懂夜的黑 提交于 2019-11-29 04:26:09
测试地址 https://www.echartsjs.com/examples/zh/editor.html?c=bar-tick-align var option = { title: { text: "存储条件(基本单位数量)", //标题 padding: [12, 4], //距离上下4px x: "center", //居中 textStyle: { color: "#3398DB", //主标题的颜色 fontSize: "18" //主标题的大小 }, }, color: ['#3398DB'], tooltip : { trigger: 'axis', formatter:'{c}%',     //这是关键,以百分比的形式显示 axisPointer : { // 坐标轴指示器,坐标轴触发有效 type : 'shadow' // 默认为直线,可选为:'line' | 'shadow' } }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis : [ { type : 'category', data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], axisTick: { alignWithLabel:

python可视化_matplotlib

无人久伴 提交于 2019-11-28 09:41:48
对于Python数据可视化库, matplotlib 已经成为事实上的数据可视化方面最主要的库,此外还有很多其他库,例如vispy,bokeh, seaborn ,pyga,folium 和 networkx,这些库有些是构建在 matplotlib 之上,还有些有其他一些功能。 目录 matplotlib 基本函数 中文乱码 plot: 线性图 bar: 柱状图 barh :水平柱状图 pie: 饼图 scatter: 散点图 hist: 直方图 stackplot: 面积图 subplot: 子图布局 GridSpec: 网格布局 matplotlib matplotlib 是一个基于 Python 的 2D 绘图库,其可以在跨平台的在各种硬拷贝格式和交互式环境中绘制出高图形。Matplotlib 能够创建多数类型的图表,如条形图,散点图,条形图,饼图,堆叠图,3D 图和地图图表。 %matplotlib 命令可以在当前的 Notebook 中启用绘图。Matlibplot 提供了多种绘图 UI ,可进行如下分类 : 弹出窗口和交互界面: %matplotlib qt 和 %matplot tk 非交互式内联绘图: %matplotlib inline 交互式内联绘图: %matplotlib notebook-->别用这个,它会让开关变得困难。 安装Matplotlib命令:

Android实现统计图 — 柱状图【自定义View】

好久不见. 提交于 2019-11-28 01:24:41
效果图: activity_main.xml: <?xml version="1.0" encoding="utf-8"?> < RelativeLayout xmlns: android = " http://schemas.android.com/apk/res/android " xmlns: app = " http://schemas.android.com/apk/res-auto " xmlns: tools = " http://schemas.android.com/tools " android: layout_width = " match_parent " android: layout_height = " match_parent " tools: context = " .MainActivity " > < ccv.turbosnail.one.PColumn android: layout_width = " 400dp " android: layout_height = " 400dp " android: layout_centerInParent = " true " /> </ RelativeLayout > 新建 PColumn 类并继承 View PColumn.java: public class PColumn extends

Echarts柱状图和折线图结合

夙愿已清 提交于 2019-11-27 20:33:57
因功能需要,需要体现业务办理量及环比,故通过echarts的柱状图和折线图结合共同达到该效果; ①柱状图因区域数量不确定,为保证查看的效果,使用 dataZoom 组件用于区域缩放; ②折线图因有正负数,故选择环比最小和最大值作为折线图的起始坐标。 另图例使用渐变色,见option设置 html elecBarChart需设定高度 <div class="full-width"> <div id="elecBarChart" class="elecBarChart"></div> </div> js //显示业务办理量趋势柱形-折线图 function showBarChart(data){ var elecBarChart = echarts.init(document.getElementById('elecBarChart')); var elecBarOption = getElecBarOption(); $scope.barMax = parseFloat(data[0].qoq); $scope.barMin = parseFloat(data[0].qoq); for(var i = 0;i < data.length;i++){ var cur = parseFloat(data[i].qoq); var cur2 = parseFloat(data[i].qoq

Python 中 plt 画柱状图和折线图

冷暖自知 提交于 2019-11-27 18:59:29
1. 背景 Python在一些数据可视化的过程中需要使用 plt 函数画柱状图和折线图。 2. 导入 import matplotlib.pyplot as plt 3. 柱状图 array= np.array(array) plt.hist(array, bins=50,facecolor="red", edgecolor="red" ,linewidth=5,alpha=0.7) plt.xlabel("") plt.ylabel("") plt.title("") 4.折线图 plt.figure(figsize=(num_group, 6)) X=[1,2,3,4,5,6,7,8,9] Y=[1,2,3,4,5,6,7,8,9]#定义折线图的X,Y坐标 plt.plot(X, Y, label=str(model_name)) #折线图for a, b in zip(X, Y): plt.text(a, b, '%.2f' % b, ha='center', va='bottom', fontsize=7)#每个点的数值 plt.legend(loc=2)#显示每根折线的labelplt.title("{}".format(eval_key))#显示图名   5.保存 print("=> saving {}".format(image_name)) plt.savefig

如何用Core Plot绘制柱状图

只愿长相守 提交于 2019-11-27 04:51:05
Core Plot提供了柱状图的绘制,不足的是,只有垂直柱状图,没有提供水平柱状图。期待下一版本的实现。 1、新建Windows-base Application。加入对Core Plot框架的引用。这里我们假设使用了Core Plot SDK ,项目设置参考前一博文《Core Plot SDK的用法》。 2、新建ViewController,首先修改ViewController的头文件,import CorePlot.h,同时实现CPPlotDataSource协议,增加一个CPGraph变量: #import <UIKit/UIKit.h> #import <CorePlot/CorePlot.h> @interface BarChartViewController : UIViewController <CPPlotDataSource> { @private CPXYGraph * barChart ; } @property ( readwrite , retain , nonatomic ) NSTimer *timer; @end 3、具体实现如下: -( void )viewDidAppear:( BOOL )animated { // 为 CPGraph 指定主题 barChart = [[ CPXYGraph alloc ] initWithFrame :

用ASP.NET with C#绘制柱状图(Bar图)

本秂侑毒 提交于 2019-11-27 04:50:12
昨天发了个绘制Curve图的,自古Curve图,Bar图,Pie图都不分家,今天就继续来绘制Bar图吧。照例图片拥有简单的缩放功能,来看看最终效果图: 其实绘制Bar图比绘制Curve图更简单,只需要绘制相应比例的方块即可,来看看初始化函数InitializeGraph()吧: // 初始化和填充图像区域,画出边框,初始标题 private void InitializeGraph() { // 根据给定的高度和宽度创建一个位图图像 objBitmap = new Bitmap(Width,Height); // 从指定的 objBitmap 对象创建 objGraphics 对象 (即在objBitmap对象中画图) objGraphics = Graphics.FromImage(objBitmap); // 根据给定颜色(LightGray)填充图像的矩形区域 (背景) objGraphics.DrawRectangle( new Pen(BorderColor, 1 ), 0 , 0 ,Width,Height); objGraphics.FillRectangle( new SolidBrush(BgColor), 1 , 1 ,Width - 2 ,Height - 2 ); // 初始化标题 CreateTitle( ref objGraphics); }