allow charts to have Y-axis min and max specified

This commit is contained in:
Lee Lawlor 2014-04-13 14:42:03 -04:00
parent dd2007de4c
commit f317d06653
5 changed files with 30 additions and 22 deletions

View File

@ -21,13 +21,11 @@ function updateChart(index,
// default width and height // default width and height
var width = width; var width = width;
var height = height; var height = height;
// get old src
// get old src
var iframe = $('#iframe' + index).attr("default_src"); var iframe = $('#iframe' + index).attr("default_src");
if (!iframe) { if (!iframe) { iframe = $('#iframe' + index).attr('src'); }
iframe = $('#iframe' + index).attr('src');
}
src = iframe.split('?')[0]; src = iframe.split('?')[0];
// if bar or column chart, a timeslice should be present or set timescale=30 // if bar or column chart, a timeslice should be present or set timescale=30
@ -83,26 +81,22 @@ function updateChart(index,
$('#iframe' + index).attr('height', height); $('#iframe' + index).attr('height', height);
} }
function updateSelectValues() { function updateSelectValues() {
selectedValue = $(this).val(); selectedValue = $(this).val();
$(".mutuallyexclusive"+index).each(function () { $(this).val(""); }); $(".mutuallyexclusive"+index).each(function () { $(this).val(""); });
$(this).val(selectedValue); $(this).val(selectedValue);
} }
function setupChartForm(channelIndex) { function setupChartForm(channelIndex) {
return function(index, value) { return function(index, value) {
if (value.length > 0) { if (value.length > 0) {
$('#' + value.split('=')[0] + "_" + channelIndex).val(decodeURIComponent(value.split('=')[1])); $('#' + value.split('=')[0] + "_" + channelIndex).val(decodeURIComponent(value.split('=')[1]));
} }
}; };
} }
function setupColumns(current_user, channel_id) {
$( sortColumnSetup(current_user, channel_id) );
$( ".column" ).disableSelection();
function setupColumns(current_user, channel_id)
{
$( sortColumnSetup(current_user, channel_id) ) ;
$( ".column" ).disableSelection();
} }
function createWindowsWithData (data, current_user, channel_id, colName) { function createWindowsWithData (data, current_user, channel_id, colName) {

View File

@ -144,6 +144,14 @@
<td><%= t(:chart_max) %>: </td> <td><%= t(:chart_max) %>: </td>
<td><input type="text" class="chart_options<%= index %> shortfield" id="max_<%= index %>" /></td> <td><input type="text" class="chart_options<%= index %> shortfield" id="max_<%= index %>" /></td>
</tr> </tr>
<tr>
<td><%= t(:chart_yaxis_min) %>: </td>
<td><input type="text" class="chart_options<%= index %> shortfield" id="yaxismin_<%= index %>" /></td>
</tr>
<tr>
<td><%= t(:chart_yaxis_max) %>: </td>
<td><input type="text" class="chart_options<%= index %> shortfield" id="yaxismax_<%= index %>" /></td>
</tr>
<tr> <tr>
<td><input type="button" id="button<%= index %>" value="<%= t(:chart_update) %>" /></td> <td><input type="button" id="button<%= index %>" value="<%= t(:chart_update) %>" /></td>
<td></td> <td></td>

View File

@ -149,9 +149,11 @@
} }
}, },
yAxis: { yAxis: {
title: { title: {
text: '' text: ''
} },
min: <%= params[:yaxismin].present? ? params[:yaxismin] : 'null '%>,
max: <%= params[:yaxismax].present? ? params[:yaxismax] : 'null' %>
}, },
exporting: { exporting: {
enabled: <%= (params[:export].present? && params[:export] == 'true') ? 'true' : 'false' %> enabled: <%= (params[:export].present? && params[:export] == 'true') ? 'true' : 'false' %>

View File

@ -33,6 +33,8 @@
<li><b>dynamic</b> (true/false) Make chart update automatically every 15 seconds, default: false (optional)</li> <li><b>dynamic</b> (true/false) Make chart update automatically every 15 seconds, default: false (optional)</li>
<li><b>step</b> (true/false) Draw chart as a step chart, default: false (optional)</li> <li><b>step</b> (true/false) Draw chart as a step chart, default: false (optional)</li>
<li><b>export</b> (true/false) Show export buttons, so that chart can be saved as an image, default: false (optional)</li> <li><b>export</b> (true/false) Show export buttons, so that chart can be saved as an image, default: false (optional)</li>
<li><b>yaxismin</b> (decimal) Minimum value of chart's Y-Axis; if blank the value is auto-calculated (optional)</li>
<li><b>yaxismax</b> (decimal) Maximum value of chart's Y-Axis; if blank the value is auto-calculated (optional)</li>
</ul> </ul>
<br> <br>

View File

@ -70,8 +70,8 @@ en:
channel_being_cleared: "This channel is currently being cleared. Any data you post to this channel before clearing is complete may be deleted." channel_being_cleared: "This channel is currently being cleared. Any data you post to this channel before clearing is complete may be deleted."
channel_video_type_blank: "Either Youtube, or Vimeo, is required if a Video ID is specified." channel_video_type_blank: "Either Youtube, or Vimeo, is required if a Video ID is specified."
chart: "Chart" chart: "Chart"
chart_max: "Max" chart_max: "Data Max"
chart_min: "Min" chart_min: "Data Min"
chart_background_color: "Background" chart_background_color: "Background"
chart_is_dynamic: "Dynamic?" chart_is_dynamic: "Dynamic?"
chart_embed_code: "Embed Code" chart_embed_code: "Embed Code"
@ -84,6 +84,8 @@ en:
chart_update: "Update Chart" chart_update: "Update Chart"
chart_xaxis: "X-Axis" chart_xaxis: "X-Axis"
chart_yaxis: "Y-Axis" chart_yaxis: "Y-Axis"
chart_yaxis_min: "Y-Axis Min"
chart_yaxis_max: "Y-Axis Max"
charts: "Charts" charts: "Charts"
charts_view: "View Charts" charts_view: "View Charts"
comment_add: "Add comment" comment_add: "Add comment"