flot

flot - line chart error

≯℡__Kan透↙ 提交于 2019-12-12 02:04:11
问题 I'm trying to plot a line graph using flot and I'm having some troubles. Admittedly I'm very new to flot. My data array is loaded from ajax calls. I think I have the data in the right format but when my page loads I'm getting an error in jquery.flot.js. Here is my javascript to load the float graph. I'm in particular looking for some advice on my x-axis specification. I don't think I have it specified right. i.e. I don't understand ticks and what they are in relation to the graph. I've shown

Flot pie chart doesn't show (revised code)

人走茶凉 提交于 2019-12-11 23:22:28
问题 I need a pie chart and found Flot. It looks simple and powerful, but all of the examples I have found describe the "data" using fixed values (e.g. [1,2]) but I need to show dynamic data. I have five variables that must ultimately add up to 100. I want to include only those that have a value > 0, and if they don't total to 100, I want to add an element that shows the missing percent. The problem is that I don't know how to dynamically construct the data parameter. My code is below. There are

Coffeescript .bind seems to be wrapped inside a function when compiled to js and is not called

久未见 提交于 2019-12-11 22:56:56
问题 I am trying to use a flot in a coffeescript .The returned javascript wraps all the methods in a function call and because of that I am not able to use the .bind event. $(this).bind 'plothover', (event, pos, item) -> is not getting called when my mouse moves $ -> $("#flot-placeholder1").text("Amit") plot = $.plot($("#flot-placeholder1"), dataset, options) $("#flot-placeholder1").UseTooltip() $.fn.UseTooltip = -> alert "UseTooltip" **$(this).bind 'plothover', (event, pos, item) ->** alert

flot jquery y axis option is not working

有些话、适合烂在心里 提交于 2019-12-11 19:53:42
问题 This is my yasix option yaxes: { min: 0, max: 100, tickFormatter: function (val, axis) { return val + '%'; } }, but when I run the chart, the max is not 100, plus there is no % sign. what wrong did i do pleaes? I didn't post other code becuase I think the problem from the code above, if you see that my code is correct and you need more code kindly tell me please 回答1: If you only have a single value, the option is yaxis instead of yaxes . If you have multiple values, you should provide an

How to render f(x) = 1/x with flot.js?

两盒软妹~` 提交于 2019-12-11 19:35:11
问题 I am considering use flot.js to render the function f(x) = 1/x for 3 cases: f(x) = 1/n , f(x) = n/x , and f(x) = 1/x +n I would like to have the student able to change n to see what happens so I will need to refresh the graph as well. I have no clue how to render the function itself. 回答1: You have to fill an array with e.g. 100 values and then use that array to plot the graph. Something like this: var f1array = []; for (var i = 1; i <= 100; i++) { f1array.push([0.1 * i, 1 / (0.1 * i)]); } $

How can I show only the last point of a Flot chart

怎甘沉沦 提交于 2019-12-11 18:51:44
问题 I have made a Flot chart that uses the settings below and the graph depicted is a line with 4 points (every time). I want only the last dot (point) to be shown. Have you got any idea how can I do it? (Or probably can you tell me a way in order to put a step in my graph and show only dot after 3 points?) var chart_plot_01_settings = { series: { lines: { show: false, fill: 1, }, splines: { show: true, tension: 0.4, lineWidth: 2, fill: 0.1, }, points: { radius: 8, lineWidth: 1, show: false,

Convert Flot Chart so that it dynamically updates at 60 second intervals

假如想象 提交于 2019-12-11 18:04:33
问题 I have a .php page that renders out a line plot Flot chart by querying my database. I would love some assistance in creating some ajax (or otherwise) code to dynamically update it every 60 seconds. Below is what I have. Thanks in advance:) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style

Referencing php in javascript

十年热恋 提交于 2019-12-11 17:47:59
问题 I am trying to call a php code which retrieves data from mysql table and populate it to an array and accessing it in the javascript. But screen shows nothing I know for sure there is no problem with php in populating the data, and referencing the php variable in javascript I have included the file and the file is in my Eclipse (juno) project only. But still why I get this problem? Any suggestions please? sample.jsp : <div id="placeholder" style="width:600px;height:300px;"></div> <script type=

How do I pass a simple JSON array to jQuery then Flot?

随声附和 提交于 2019-12-11 14:11:42
问题 I've been Googling for a while trying to find a solution to my problem, but everything I've found which comes close is too complicated! I have a working Flot pie chart. It receives a JSON array from Django in this format: [0, 3, 5, 6, 7] The array represents the number of instances of each series (i.e. 0 instances of Series 1, 3 instances of Series 2 etc etc). That array is then shown in a simple Flot Pie Chart using this code ( theData is the array above): function loadTotalChart(theData) {

Using function() to create dynamic response

妖精的绣舞 提交于 2019-12-11 13:59:33
问题 The following code works: tooltipOpts: { content: "%s : %y", shifts: { x: -30, y: -50 } } I am trying to show some dynamically calculated data in "content" so am trying to use a function. Even my most basic example isn't working, I get error shown below: tooltipOpts: { content: function() { return "%s : %y"; }, shifts: { x: -30, y: -50 } } Uncaught TypeError: Object function () { return "%s : %y"; } has no method 'replace' 回答1: I'll assume you are using the tooltip plugin from here. I've