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,41 +897,32 @@ define('Graph', ['logme'], function (logme) { ...@@ -882,41 +897,32 @@ 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) { plotDiv,
plotObj = $.plot( dataSeries,
plotDiv, {
dataSeries, 'xaxis': xaxis,
{ 'yaxis': yaxis,
'xaxis': xaxis, 'legend': {
'yaxis': yaxis,
'legend': { // To show the legend or not. Note, even if 'show' is
// 'true', the legend will only show if labels are
// To show the legend or not. Note, even if 'show' is // provided for at least one of the series that are
// 'true', the legend will only show if labels are // going to be plotted.
// provided for at least one of the series that are 'show': true,
// going to be plotted.
'show': true, // A floating point number in the range [0, 1]. The
// smaller the number, the more transparent will the
// A floating point number in the range [0, 1]. The // legend background become.
// smaller the number, the more transparent will the 'backgroundOpacity': 0
// legend background become.
'backgroundOpacity': 0 },
'grid': {
}, 'markings': generateMarkings()
'grid': {
'markings': generateMarkings()
}
} }
); }
} );
// 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