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) { ...@@ -154,6 +154,11 @@ define('Graph', ['logme'], function (logme) {
newAsyObj.color = asyObj['@color']; newAsyObj.color = asyObj['@color'];
} }
newAsyObj.label = false;
if (typeof asyObj['@label'] === 'string') {
newAsyObj.label = asyObj['@label'];
}
paramNames.push(funcString); paramNames.push(funcString);
try { try {
...@@ -874,6 +879,16 @@ define('Graph', ['logme'], function (logme) { ...@@ -874,6 +879,16 @@ define('Graph', ['logme'], function (logme) {
dataSeries.push(seriesObj); 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; return true;
} // End-of: function generateData } // End-of: function generateData
...@@ -882,10 +897,8 @@ define('Graph', ['logme'], function (logme) { ...@@ -882,10 +897,8 @@ define('Graph', ['logme'], function (logme) {
paramValues = state.getAllParameterValues(); paramValues = state.getAllParameterValues();
// Tell Flot to draw the graph to our specification. If this is the // Tell Flot to draw the graph to our specification.
// first time, then call $.plot. $.plot(
if (plotObj === null) {
plotObj = $.plot(
plotDiv, plotDiv,
dataSeries, dataSeries,
{ {
...@@ -910,13 +923,6 @@ define('Graph', ['logme'], function (logme) { ...@@ -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 // The first time that the graph gets added to the page, the legend
// is created from scratch. When it appears, MathJax works some // 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