flot

Flot: How to keep x and y axes the same scale?

≯℡__Kan透↙ 提交于 2019-12-10 10:16:21
问题 I want to plot on a standard Cartesian plane, so 1 unit on x axis has the same length as 1 unit on y axis. I also use the navigate plugin to zoom and pan. Is there anyway I can have this constraint? can't find anything about this in Flot api. Thanks, 回答1: I had to do something similar and this was the first test: fiddle The main point is that you set the max values for the axis in the same ratio as the width and height of your placeholder div: options.xaxes[0].max = options.yaxes[0].max * $('

How to render this bar chart with flot

旧巷老猫 提交于 2019-12-09 11:36:42
问题 Can you render a bar chart like this using flot? Do I need to create the dataset manually to get this result, instead of using mode: 'time' ? 回答1: Actually pretty easy to produce using flot. var options = { series: { bars: { show: true, barWidth: 15778463000, // 1/2 year in milliseconds align: 'center' }, }, yaxes: { min: 0 }, xaxis: { mode: 'time', timeformat: "%y", tickSize: [1, "year"], autoscaleMargin: .10 // allow space left and right } }; $(function() { $.plot($('#placeholder'), [[

What is the format of jQuery Flot data when passing in the data as variables

ε祈祈猫儿з 提交于 2019-12-09 07:32:28
I have been trying to create a jQuery Flot pie chart, but I can't get the "data" parameter to work. I have 0..6 values that should total to 100(%), and these values need to be added individually, one label value pair at a time. All of the examples I have seen assume that the data values are hard wired, and unfortunately that is not the way the real world works. I need some real world examples of how to construct the label - data pairs that Flot uses. I finally got it working when I realized that the data is supposed to be in jSON object notation. The old light bulb may be dim, but not entirely

Add or highlight a single points on a jQuery flot graph?

一世执手 提交于 2019-12-08 13:37:32
I've already drawn a flot graph using some data: var plot = $.plot($("#placeholder"), [{ data: data, }], { series: { points: { show: true } }, grid: { hoverable: true, } }); Now I'd like to highlight a single point on the graph, when a user hovers over an item elsewhere on the page. I found this question , which explains how to totally redraw the series from scratch, but is there a way to highlight a single point? Or add a new point in a different colour, which would have the effect of a highlight? NB: when the user hovers over the relevant item elsewhere on the page, I will have the x and y

Customize tooltip in FLOT graph

空扰寡人 提交于 2019-12-08 09:31:33
问题 I am using FLOT to display graphs. To display tootip i am using https://github.com/krzysu/flot.tooltip. Now I want to customize content of tooltip so I am using callback to set content of tooltip. Code snippet: tooltip: true, tooltipOpts: { content: function(label, xval, yval, flotItem){ var xAxis = plot.getXAxes(); return xval; }, defaultTheme: false } But its giving me error caught TypeError: Object function (label, xval, yval, flotItem){ var xAxis = plot.getXAxes(); return xval; } has no

What is the format of jQuery Flot data when passing in the data as variables

痴心易碎 提交于 2019-12-08 06:40:49
问题 I have been trying to create a jQuery Flot pie chart, but I can't get the "data" parameter to work. I have 0..6 values that should total to 100(%), and these values need to be added individually, one label value pair at a time. All of the examples I have seen assume that the data values are hard wired, and unfortunately that is not the way the real world works. I need some real world examples of how to construct the label - data pairs that Flot uses. 回答1: I finally got it working when I

plotting Graph with flot

断了今生、忘了曾经 提交于 2019-12-08 06:37:54
问题 I want to plot graph using flot and mysql but an exception occurs getData.php $sql = mysql_query("SELECT count(Msg_ID) as msgCount,From_user FROM Messages GROUP BY From_user"); echo "["; while($result = mysql_fetch_array($sql)) { //print_r($result); echo "[".$result['msgCount'].",".$result['From_user']."]"."\n"; } echo "]"; And for plotting <div id="plotarea" style="width:600px;height:300px;"> <script type="text/javascript"> var options = { lines: { show: true }, points: { show: true }, xaxis

Add or highlight a single points on a jQuery flot graph?

不打扰是莪最后的温柔 提交于 2019-12-08 04:30:41
问题 I've already drawn a flot graph using some data: var plot = $.plot($("#placeholder"), [{ data: data, }], { series: { points: { show: true } }, grid: { hoverable: true, } }); Now I'd like to highlight a single point on the graph, when a user hovers over an item elsewhere on the page. I found this question, which explains how to totally redraw the series from scratch, but is there a way to highlight a single point? Or add a new point in a different colour, which would have the effect of a

Double axes in flot

帅比萌擦擦* 提交于 2019-12-08 04:21:56
问题 I want to create a graph with four quadrants using flot. I need to have labels on both the left and right-hand sides of the graph - with the same ticks. Here is my code: $.plot($("#placeholder"), [ [<%=points%>] ], { series: {lines: { show: false }, points: { show: true }}, yaxes: [{ ticks:[[0,"Left"]],max: 100, min:-100 }, { position: "Right",ticks:[[0,"Right"]], max:100, min: -100 }], xaxis: { ticks:[[0,"Bottom"]], max: 100, min:-100 } }); I get the "Left" and "Bottom" labels but nothing on

jQuery flot more space at the top

谁说胖子不能爱 提交于 2019-12-08 02:53:06
问题 How can i create more space at the top of the charts? Now i get this: But i want this: This is my JS code: $("table.chart").each(function() { var colors = []; $("table.chart thead th:not(:first)").each(function() { colors.push($(this).css("color")); }); $(this).graphTable({ series: 'columns', position: 'replace', width: '100%', height: '200px', colors: colors }, { xaxis: { tickSize: 1 } }); }); 回答1: Adjust the autoscaleMargin property of the y axis. From the API: The "autoscaleMargin" is a