Commit 20227d21 by Valera Rozuvan Committed by Alexander Kryklia

Added new feature: ability to add a label for an asymptote. Added new demo to…

Added new feature: ability to add a label for an asymptote. Added new demo to GST: "Power and Alpha Demo".
parent def8eb47
......@@ -154,6 +154,11 @@ define('Graph', ['logme'], function (logme) {
newAsyObj.color = asyObj['@color'];
}
newAsyObj.label = false;
if (typeof asyObj['@label'] === 'string') {
newAsyObj.label = asyObj['@label'];
}
paramNames.push(funcString);
try {
......@@ -874,6 +879,16 @@ define('Graph', ['logme'], function (logme) {
dataSeries.push(seriesObj);
}
for (c0 = 0; c0 < asymptotes.length; c0 += 1) {
if (typeof asymptotes[c0].label === 'string') {
dataSeries.push({
'data': [],
'label': asymptotes[c0].label,
'color': asymptotes[c0].color
});
}
}
return true;
} // End-of: function generateData
......@@ -882,10 +897,8 @@ define('Graph', ['logme'], function (logme) {
paramValues = state.getAllParameterValues();
// Tell Flot to draw the graph to our specification. If this is the
// first time, then call $.plot.
if (plotObj === null) {
plotObj = $.plot(
// Tell Flot to draw the graph to our specification.
$.plot(
plotDiv,
dataSeries,
{
......@@ -910,13 +923,6 @@ define('Graph', ['logme'], function (logme) {
}
}
);
}
// Otherwise, use stored plot object.
else {
plotObj.setData(dataSeries);
plotObj.setupGrid();
plotObj.draw();
}
// The first time that the graph gets added to the page, the legend
// is created from scratch. When it appears, MathJax works some
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment