[有关问题]js数组和php数组的重口味关系
[问题]js数组和php数组的重口味关系
这两天在学习js 的图表生成.其中需要给js 传递这么一个数组.这是范例内的数组.所以现在的问题是
有没有快捷的方式通过php来生成这个数组? 还是需要根据这个数组结构自己人肉的用php来各种组合?
- JScript code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> series:[ { type:"column", name:"阿里巴巴", data:[3, 2, 1, 3, 4] }, { type:"column", name:"John", data:[2, 3, 5, 7, 6] }, { type:"column", name:"Joe", data:[4, 3, 3, 9, 0] }, { type:"spline", name:"Average", data:[3, 2.67, 3, 6.33, 3.33], marker:{ lineWidth:2, lineColor:Highcharts.getOptions().colors[3], fillColor:"white" } }, { type:"pie", name:"Total consumption", data:[ { name:"Jane", y:13, color:"#4572A7" // Jane"s color }, { name:"John", y:23, color:"#AA4643" // John"s color }, { name:"Joe", y:19, color:"#89A54E" // Joe"s color } ], center:[100, 80], size:100, showInLegend:false, dataLabels:{ enabled:false } } ]
------解决方案--------------------
newnew, 你这是哪个js库的?
我觉得首先要分析下前后端需要交互哪些数据.
1. 图表要用到的数据肯定是要前后交互的;
2. 图表展示用到的渲染选项, 比如showInLegend:false这样的数据得看你的业务, 如果你的图表有一些渲染项是后台配置的, 那也需要交互
3. 即便渲染项需要后台配置, 通常也不需要暴露全部渲染项给后台, 因此需要分析出要暴露给后台配置管理的渲染项
4. 搞清楚这些后, 再来制定前后台通讯的协议, 比如可以将数据分为数据和渲染项两部分, 前端拿到之后, 自己进行业务处理.
你讲下是什么图表控件及具体业务, 可以具体给你看看
------解决方案--------------------
所有的数据都包装在 chart = new Highcharts.Chart() 参数中
单独分割出来可能会对 js 代码组装产生困难
似乎没有看到说明文档,可考虑从他提供的48个样例中抽取参数,从 Chart({ 开始,到 }); 结束,进行分析
然后写成若干个类
工作量应该不算太大
他是 js 代码级的 json 格式,而不是数据交换的 json 格式。你用 php 产生的 json 作为参数是不会有问题的

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The usage of the Type keyword in Go includes defining new type aliases or creating new structure types. Detailed introduction: 1. Type alias. Use the "type" keyword to create an alias for an existing type. This alias does not create a new type, but only provides a new name for the existing type. Type aliases can improve code. The readability of the code makes the code clearer; 2. Structure type. Use the "type" keyword to create a new structure type. The structure is a composite type that can be used to define custom types containing multiple fields. etc.

An error occurs when ubuntu mounts a mobile hard disk: mount: unknownfilesystemtype'exfat'. The processing method is as follows: Ubuntu13.10 or install exfat-fuse: sudoapt-getinstallexfat-fuseUbuntu13.04 or below sudoapt-add-repositoryppa:relan/exfatsudoapt-getupdatesudoapt-getinstallfuse- exfatCentOS Linux mount exfat format USB disk error solution to load extfa in CentOS

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

The data folder contains system and program data, such as software settings and installation packages. Each folder in the Data folder represents a different type of data storage folder, regardless of whether the Data file refers to the file name Data or the extension. Named data, they are all data files customized by the system or program. Data is a backup file for data storage. Generally, it can be opened with meidaplayer, notepad or word.

In this guide, we will learn more about the "type" command in Linux. Prerequisites: To perform the steps demonstrated in this guide, you need the following components: A properly configured Linux system. See how to create a LinuxVM for testing and learning purposes. Basic understanding of the command line interface The Type command in Linux is different from other Linux-specific commands (for example: ls, chmod, shutdown, vi, grep, pwd, etc.). The "type" command is a built-in Bash function that is displayed as an argument. Information about the command type provided. $type In addition to Bash, other shells (Zsh, Ksh, etc.) also come with

The solution to the garbled mysql load data: 1. Find the SQL statement with garbled characters; 2. Modify the statement to "LOAD DATA LOCAL INFILE "employee.txt" INTO TABLE EMPLOYEE character set utf8;".

The differences are: 1. xdata usually refers to independent variables, while data refers to the entire data set; 2. xdata is mainly used to establish data analysis models, while data is used for data analysis and statistics; 3. xdata is usually used for regression Analysis, variance analysis, predictive modeling, data can be analyzed using various statistical methods; 4. xdata usually requires data preprocessing, and data can contain complete original data.

Required information: 1. Email registration; 2. Mobile phone number registration; 3. Third-party social platform registration. After successful registration, you usually need to fill in some basic personal information, such as nickname, gender, birthday, etc.
