Fixed errors VC
This commit is contained in:
parent
d99d31b432
commit
0042f390ef
|
@ -213,8 +213,10 @@ if ($config['menu_type'] == 'classic') {
|
||||||
$select[0]['autorefresh_white_list']
|
$select[0]['autorefresh_white_list']
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($_GET['sec2'] === 'operation/visual_console/render_view'
|
if ($config['legacy_vc']
|
||||||
&& $config['legacy_vc']
|
|| ($_GET['sec2'] !== 'operation/visual_console/render_view')
|
||||||
|
|| (($_GET['sec2'] !== 'operation/visual_console/render_view')
|
||||||
|
&& $config['legacy_vc'])
|
||||||
) {
|
) {
|
||||||
if ($autorefresh_list !== null
|
if ($autorefresh_list !== null
|
||||||
&& array_search($_GET['sec2'], $autorefresh_list) !== false
|
&& array_search($_GET['sec2'], $autorefresh_list) !== false
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
/* globals d3 */
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
// Chart design based on the recommendations of Stephen Few. Implementation
|
// Chart design based on the recommendations of Stephen Few. Implementation
|
||||||
// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
|
// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
|
||||||
// http://projects.instantcognition.com/protovis/bulletchart/
|
// http://projects.instantcognition.com/protovis/bulletchart/
|
||||||
|
|
||||||
d3.bullet = function() {
|
d3.bullet = function() {
|
||||||
var orient = "right", // TODO top & bottom
|
var orient = "right", // TODO top & bottom
|
||||||
reverse = false,
|
reverse = false,
|
||||||
|
@ -17,18 +18,31 @@ d3.bullet = function() {
|
||||||
// For each small multiple…
|
// For each small multiple…
|
||||||
function bullet(g) {
|
function bullet(g) {
|
||||||
g.each(function(d, i) {
|
g.each(function(d, i) {
|
||||||
var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
|
var rangez = ranges
|
||||||
markerz = markers.call(this, d, i).slice().sort(d3.descending),
|
.call(this, d, i)
|
||||||
measurez = measures.call(this, d, i).slice().sort(d3.descending),
|
.slice()
|
||||||
|
.sort(d3.descending),
|
||||||
|
markerz = markers
|
||||||
|
.call(this, d, i)
|
||||||
|
.slice()
|
||||||
|
.sort(d3.descending),
|
||||||
|
measurez = measures
|
||||||
|
.call(this, d, i)
|
||||||
|
.slice()
|
||||||
|
.sort(d3.descending),
|
||||||
g = d3.select(this);
|
g = d3.select(this);
|
||||||
|
|
||||||
// Compute the new x-scale.
|
// Compute the new x-scale.
|
||||||
var x1 = d3.scale.linear()
|
var x1 = d3.scale
|
||||||
|
.linear()
|
||||||
.domain([0, Math.max(rangez[0], markerz[0], measurez[0])])
|
.domain([0, Math.max(rangez[0], markerz[0], measurez[0])])
|
||||||
.range(reverse ? [width, 0] : [0, width - 160]);
|
.range(reverse ? [width, 0] : [0, width - 160]);
|
||||||
|
|
||||||
// Retrieve the old x-scale, if this is an update.
|
// Retrieve the old x-scale, if this is an update.
|
||||||
var x0 = this.__chart__ || d3.scale.linear()
|
var x0 =
|
||||||
|
this.__chart__ ||
|
||||||
|
d3.scale
|
||||||
|
.linear()
|
||||||
.domain([0, Infinity])
|
.domain([0, Infinity])
|
||||||
.range(x1.range());
|
.range(x1.range());
|
||||||
|
|
||||||
|
@ -40,11 +54,14 @@ d3.bullet = function() {
|
||||||
w1 = bulletWidth(x1);
|
w1 = bulletWidth(x1);
|
||||||
|
|
||||||
// Update the range rects.
|
// Update the range rects.
|
||||||
var range = g.selectAll("rect.range")
|
var range = g.selectAll("rect.range").data(rangez);
|
||||||
.data(rangez);
|
|
||||||
|
|
||||||
range.enter().append("rect")
|
range
|
||||||
.attr("class", function(d, i) { return "range s" + i; })
|
.enter()
|
||||||
|
.append("rect")
|
||||||
|
.attr("class", function(d, i) {
|
||||||
|
return "range s" + i;
|
||||||
|
})
|
||||||
.attr("width", w0)
|
.attr("width", w0)
|
||||||
.attr("height", height)
|
.attr("height", height)
|
||||||
.attr("x", reverse ? x0 : 0)
|
.attr("x", reverse ? x0 : 0)
|
||||||
|
@ -53,18 +70,22 @@ d3.bullet = function() {
|
||||||
.attr("width", w1)
|
.attr("width", w1)
|
||||||
.attr("x", reverse ? x1 : 0);
|
.attr("x", reverse ? x1 : 0);
|
||||||
|
|
||||||
range.transition()
|
range
|
||||||
|
.transition()
|
||||||
.duration(duration)
|
.duration(duration)
|
||||||
.attr("x", reverse ? x1 : 0)
|
.attr("x", reverse ? x1 : 0)
|
||||||
.attr("width", w1)
|
.attr("width", w1)
|
||||||
.attr("height", height);
|
.attr("height", height);
|
||||||
|
|
||||||
// Update the measure rects.
|
// Update the measure rects.
|
||||||
var measure = g.selectAll("rect.measure")
|
var measure = g.selectAll("rect.measure").data(measurez);
|
||||||
.data(measurez);
|
|
||||||
|
|
||||||
measure.enter().append("rect")
|
measure
|
||||||
.attr("class", function(d, i) { return "measure s" + i; })
|
.enter()
|
||||||
|
.append("rect")
|
||||||
|
.attr("class", function(d, i) {
|
||||||
|
return "measure s" + i;
|
||||||
|
})
|
||||||
.attr("width", w0)
|
.attr("width", w0)
|
||||||
.attr("height", height / 3)
|
.attr("height", height / 3)
|
||||||
.attr("x", reverse ? x0 : 0)
|
.attr("x", reverse ? x0 : 0)
|
||||||
|
@ -74,7 +95,8 @@ d3.bullet = function() {
|
||||||
.attr("width", w1)
|
.attr("width", w1)
|
||||||
.attr("x", reverse ? x1 : 0);
|
.attr("x", reverse ? x1 : 0);
|
||||||
|
|
||||||
measure.transition()
|
measure
|
||||||
|
.transition()
|
||||||
.duration(duration)
|
.duration(duration)
|
||||||
.attr("width", w1)
|
.attr("width", w1)
|
||||||
.attr("height", height / 3)
|
.attr("height", height / 3)
|
||||||
|
@ -82,73 +104,84 @@ d3.bullet = function() {
|
||||||
.attr("y", height / 3);
|
.attr("y", height / 3);
|
||||||
|
|
||||||
// Update the marker lines.
|
// Update the marker lines.
|
||||||
var marker = g.selectAll("line.marker")
|
var marker = g.selectAll("line.marker").data(markerz);
|
||||||
.data(markerz);
|
|
||||||
|
|
||||||
marker.enter().append("line")
|
marker
|
||||||
.attr("class", function(d, i) { return "marker s" + i; })
|
.enter()
|
||||||
|
.append("line")
|
||||||
|
.attr("class", function(d, i) {
|
||||||
|
return "marker s" + i;
|
||||||
|
})
|
||||||
.attr("x1", x0)
|
.attr("x1", x0)
|
||||||
.attr("x2", x0)
|
.attr("x2", x0)
|
||||||
.attr("y1", height / 6)
|
.attr("y1", height / 6)
|
||||||
.attr("y2", height * 5 / 6)
|
.attr("y2", (height * 5) / 6)
|
||||||
.transition()
|
.transition()
|
||||||
.duration(duration)
|
.duration(duration)
|
||||||
.attr("x1", x1)
|
.attr("x1", x1)
|
||||||
.attr("x2", x1);
|
.attr("x2", x1);
|
||||||
|
|
||||||
marker.transition()
|
marker
|
||||||
|
.transition()
|
||||||
.duration(duration)
|
.duration(duration)
|
||||||
.attr("x1", x1)
|
.attr("x1", x1)
|
||||||
.attr("x2", x1)
|
.attr("x2", x1)
|
||||||
.attr("y1", height / 6)
|
.attr("y1", height / 6)
|
||||||
.attr("y2", height * 5 / 6);
|
.attr("y2", (height * 5) / 6);
|
||||||
|
|
||||||
// Compute the tick format.
|
// Compute the tick format.
|
||||||
var format = tickFormat || x1.tickFormat(8);
|
var format = tickFormat || x1.tickFormat(8);
|
||||||
|
|
||||||
// Update the tick groups.
|
// Update the tick groups.
|
||||||
var tick = g.selectAll("g.tick")
|
var tick = g.selectAll("g.tick").data(x1.ticks(8), function(d) {
|
||||||
.data(x1.ticks(8), function(d) {
|
|
||||||
return this.textContent || format(d);
|
return this.textContent || format(d);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Initialize the ticks with the old scale, x0.
|
// Initialize the ticks with the old scale, x0.
|
||||||
var tickEnter = tick.enter().append("g")
|
var tickEnter = tick
|
||||||
|
.enter()
|
||||||
|
.append("g")
|
||||||
.attr("class", "tick")
|
.attr("class", "tick")
|
||||||
.attr("transform", bulletTranslate(x0))
|
.attr("transform", bulletTranslate(x0))
|
||||||
.style("opacity", 1e-6);
|
.style("opacity", 1e-6);
|
||||||
|
|
||||||
tickEnter.append("line")
|
tickEnter
|
||||||
|
.append("line")
|
||||||
.attr("y1", height)
|
.attr("y1", height)
|
||||||
.attr("y2", height * 7 / 6);
|
.attr("y2", (height * 7) / 6);
|
||||||
|
|
||||||
tickEnter.append("text")
|
tickEnter
|
||||||
|
.append("text")
|
||||||
.attr("text-anchor", "middle")
|
.attr("text-anchor", "middle")
|
||||||
.attr("dy", "1em")
|
.attr("dy", "1em")
|
||||||
.attr("y", height * 7 / 6)
|
.attr("y", (height * 7) / 6)
|
||||||
.text(format);
|
.text(format);
|
||||||
|
|
||||||
// Transition the entering ticks to the new scale, x1.
|
// Transition the entering ticks to the new scale, x1.
|
||||||
tickEnter.transition()
|
tickEnter
|
||||||
|
.transition()
|
||||||
.duration(duration)
|
.duration(duration)
|
||||||
.attr("transform", bulletTranslate(x1))
|
.attr("transform", bulletTranslate(x1))
|
||||||
.style("opacity", 1);
|
.style("opacity", 1);
|
||||||
|
|
||||||
// Transition the updating ticks to the new scale, x1.
|
// Transition the updating ticks to the new scale, x1.
|
||||||
var tickUpdate = tick.transition()
|
var tickUpdate = tick
|
||||||
|
.transition()
|
||||||
.duration(duration)
|
.duration(duration)
|
||||||
.attr("transform", bulletTranslate(x1))
|
.attr("transform", bulletTranslate(x1))
|
||||||
.style("opacity", 1);
|
.style("opacity", 1);
|
||||||
|
|
||||||
tickUpdate.select("line")
|
tickUpdate
|
||||||
|
.select("line")
|
||||||
.attr("y1", height)
|
.attr("y1", height)
|
||||||
.attr("y2", height + 7);
|
.attr("y2", height + 7);
|
||||||
|
|
||||||
tickUpdate.select("text")
|
tickUpdate.select("text").attr("y", height + 7);
|
||||||
.attr("y", height + 7);
|
|
||||||
|
|
||||||
// Transition the exiting ticks to the new scale, x1.
|
// Transition the exiting ticks to the new scale, x1.
|
||||||
tick.exit().transition()
|
tick
|
||||||
|
.exit()
|
||||||
|
.transition()
|
||||||
.duration(duration)
|
.duration(duration)
|
||||||
.attr("transform", bulletTranslate(x1))
|
.attr("transform", bulletTranslate(x1))
|
||||||
.style("opacity", 1e-6)
|
.style("opacity", 1e-6)
|
||||||
|
@ -237,5 +270,4 @@ function bulletWidth(x) {
|
||||||
return Math.abs(x(d) - x0);
|
return Math.abs(x(d) - x0);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
|
@ -175,12 +175,15 @@ function d3_bullet_chart(
|
||||||
$output = '';
|
$output = '';
|
||||||
$output .= include_javascript_d3(true);
|
$output .= include_javascript_d3(true);
|
||||||
|
|
||||||
|
$output .= '<script language="javascript" type="text/javascript">';
|
||||||
|
$output .= file_get_contents($homeurl.'include/graphs/bullet.js');
|
||||||
|
$output .= '</script>';
|
||||||
|
|
||||||
$id_bullet = uniqid();
|
$id_bullet = uniqid();
|
||||||
$font = array_shift(explode('.', array_pop(explode('/', $font))));
|
$font = array_shift(explode('.', array_pop(explode('/', $font))));
|
||||||
|
|
||||||
$output .= '<div id="bullet_graph_'.$id_bullet.'" class="bullet" style="overflow: hidden; width: '.$width.'px; margin-left: auto; margin-right: auto;"></div>
|
$output .= '<div id="bullet_graph_'.$id_bullet.'" class="bullet" style="overflow: hidden; width: '.$width.'px; margin-left: auto; margin-right: auto;"></div>
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
.bullet_graph {
|
.bullet_graph {
|
||||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
|
@ -204,13 +207,12 @@ function d3_bullet_chart(
|
||||||
.bullet g text { font-size:'.$font_size.'pt;}
|
.bullet g text { font-size:'.$font_size.'pt;}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script src="'.$homeurl.'include/graphs/bullet.js"></script>
|
|
||||||
<script language="javascript" type="text/javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
|
|
||||||
var margin = {top: 5, right: 40, bottom: 20, left: 120};
|
var margin = {top: 5, right: 40, bottom: 20, left: 120};
|
||||||
|
|
||||||
width = ('.$width.'+10);
|
var width = ('.$width.'+10);
|
||||||
height = '.$height.'- margin.top - margin.bottom;
|
var height = '.$height.'- margin.top - margin.bottom;
|
||||||
|
|
||||||
var chart = d3.bullet()
|
var chart = d3.bullet()
|
||||||
.width(width)
|
.width(width)
|
||||||
|
@ -240,7 +242,6 @@ function d3_bullet_chart(
|
||||||
$output .= 'var data = ['.implode(',', $temp).'];
|
$output .= 'var data = ['.implode(',', $temp).'];
|
||||||
';
|
';
|
||||||
$output .= '
|
$output .= '
|
||||||
|
|
||||||
var svg = d3.select("#bullet_graph_'.$id_bullet.'").selectAll("svg")
|
var svg = d3.select("#bullet_graph_'.$id_bullet.'").selectAll("svg")
|
||||||
.data(data)
|
.data(data)
|
||||||
.enter().append("svg")
|
.enter().append("svg")
|
||||||
|
@ -251,7 +252,6 @@ function d3_bullet_chart(
|
||||||
.attr("transform", "translate(" + (margin.left) + "," + margin.top + ")")
|
.attr("transform", "translate(" + (margin.left) + "," + margin.top + ")")
|
||||||
.call(chart);
|
.call(chart);
|
||||||
|
|
||||||
|
|
||||||
var title = svg.append("g")
|
var title = svg.append("g")
|
||||||
.style("text-anchor", "end")
|
.style("text-anchor", "end")
|
||||||
.attr("transform", "translate(-10, 15)");
|
.attr("transform", "translate(-10, 15)");
|
||||||
|
@ -266,17 +266,15 @@ function d3_bullet_chart(
|
||||||
.text(function(d) { return d.subtitle; });
|
.text(function(d) { return d.subtitle; });
|
||||||
|
|
||||||
$(".tick>text").each(function() {
|
$(".tick>text").each(function() {
|
||||||
|
var label = $(this).text().replace(/,/g,"");
|
||||||
label = $(this).text().replace(/,/g,"");
|
|
||||||
label = parseFloat(label);
|
label = parseFloat(label);
|
||||||
text = label.toLocaleString();
|
var text = label.toLocaleString();
|
||||||
if ( label >= 1000000)
|
if ( label >= 1000000)
|
||||||
text = text.substring(0,3) + "M";
|
text = text.substring(0,3) + "M";
|
||||||
else if (label >= 100000)
|
else if (label >= 100000)
|
||||||
text = text.substring(0,3) + "K";
|
text = text.substring(0,3) + "K";
|
||||||
else if (label >= 1000)
|
else if (label >= 1000)
|
||||||
text = text.substring(0,2) + "K";
|
text = text.substring(0,2) + "K";
|
||||||
|
|
||||||
$(this).text(text);
|
$(this).text(text);
|
||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
|
|
|
@ -2248,8 +2248,6 @@ class Item extends CachedModel
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields[0] = __('None');
|
|
||||||
|
|
||||||
$getAllVisualConsoleValue = $values['linkedLayoutId'];
|
$getAllVisualConsoleValue = $values['linkedLayoutId'];
|
||||||
if (\is_metaconsole() === true) {
|
if (\is_metaconsole() === true) {
|
||||||
$getAllVisualConsoleValue = $values['linkedLayoutId'];
|
$getAllVisualConsoleValue = $values['linkedLayoutId'];
|
||||||
|
@ -2268,6 +2266,8 @@ class Item extends CachedModel
|
||||||
'selected' => $getAllVisualConsoleValue,
|
'selected' => $getAllVisualConsoleValue,
|
||||||
'script' => 'linkedVisualConsoleChange()',
|
'script' => 'linkedVisualConsoleChange()',
|
||||||
'return' => true,
|
'return' => true,
|
||||||
|
'nothing' => __('None'),
|
||||||
|
'nothing_value' => 0,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -426,8 +426,6 @@ final class ModuleGraph extends Item
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
$data[0] = __('None');
|
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -578,6 +576,8 @@ final class ModuleGraph extends Item
|
||||||
'name' => 'customGraphId',
|
'name' => 'customGraphId',
|
||||||
'selected' => $values['customGraphId'],
|
'selected' => $values['customGraphId'],
|
||||||
'return' => true,
|
'return' => true,
|
||||||
|
'nothing' => __('None'),
|
||||||
|
'nothing_value' => 0,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -710,6 +710,10 @@ div.module-graph {
|
||||||
min-height: fit-content;
|
min-height: fit-content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.textDecorationNone:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* Styles for the solid icons */
|
/* Styles for the solid icons */
|
||||||
|
|
||||||
.fa {
|
.fa {
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -505,6 +505,7 @@ if ($edit_capable === true) {
|
||||||
$('#edit-controls').css('visibility', '');
|
$('#edit-controls').css('visibility', '');
|
||||||
} else {
|
} else {
|
||||||
visualConsoleManager.visualConsole.disableEditMode();
|
visualConsoleManager.visualConsole.disableEditMode();
|
||||||
|
visualConsoleManager.visualConsole.unSelectItems();
|
||||||
visualConsoleManager.changeUpdateInterval(<?php echo ($refr * 1000); ?>); // To ms.
|
visualConsoleManager.changeUpdateInterval(<?php echo ($refr * 1000); ?>); // To ms.
|
||||||
$('#edit-controls').css('visibility', 'hidden');
|
$('#edit-controls').css('visibility', 'hidden');
|
||||||
}
|
}
|
||||||
|
|
|
@ -486,12 +486,18 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
||||||
let box;
|
let box;
|
||||||
if (this.props.isLinkEnabled) {
|
if (this.props.isLinkEnabled) {
|
||||||
box = document.createElement("a") as HTMLAnchorElement;
|
box = document.createElement("a") as HTMLAnchorElement;
|
||||||
if (this.props.link) box.href = this.props.link;
|
|
||||||
|
if (this.props.link) {
|
||||||
|
box.href = this.props.link;
|
||||||
|
} else {
|
||||||
|
box.className = "textDecorationNone";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
box = document.createElement("div") as HTMLDivElement;
|
box = document.createElement("div") as HTMLDivElement;
|
||||||
|
box.className = "textDecorationNone";
|
||||||
}
|
}
|
||||||
|
|
||||||
box.className = "visual-console-item";
|
box.classList.add("visual-console-item");
|
||||||
if (this.props.isOnTop) {
|
if (this.props.isOnTop) {
|
||||||
box.classList.add("is-on-top");
|
box.classList.add("is-on-top");
|
||||||
}
|
}
|
||||||
|
|
|
@ -531,3 +531,7 @@ div.module-graph {
|
||||||
min-width: fit-content;
|
min-width: fit-content;
|
||||||
min-height: fit-content;
|
min-height: fit-content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.textDecorationNone:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue