|
|
|
|
Quellcode-Bibliothek chap5.html
Sprache: HTML
|
|
| products/Sources/formale Sprachen/GAP/pkg/jupyterviz/doc/chap5.html |
 |
<?xml version= "1.0" encoding= "UTF-8"?>
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
< html xmlns= "http://www.w3.org/1999/xhtml" xml:lang= "en">
< head>
< title>GAP (JupyterViz) - Chapter 5: Adding new visualization tools</ title>
< meta http-equiv= "content-type" content= "text/html; charset=UTF-8" />
< meta name= "generator" content= "GAPDoc2HTML" />
< link rel= "stylesheet" type= "text/css" href= "manual.css" />
< script src= "manual.js" type= "text/javascript
<java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for leng th 57
<>
<body class="chap5" onload=java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<div class="chlinktop"><span class="chlink1">Goto Chapter: </span><a href
<div class="chlinkprevnexttop"> <a href="chap0.html">[Top of Book]</a> <a href="chap0.html#contents">[Contents]</a> <a href="chap4.html">[Previous Chapter]</a>
<p id="mathjaxlink" class="pcenter"><a href="chap5_mj.html">[MathJax on]</a
<>aid=X81249ADA79916213name""<a</>
<div class="ChapSects"><a href="chap5.html#X81249ADA79916213">5 <java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 0
<div class="ContSect"><span class="tocline"><span java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 0
<span
</div>
<div class="ContSect"><span class="tocline"><span classjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
</div>
<div class="ContSect"><span class
</span>
</div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap5.html#X8434DB9C80EC7E6B">5.4 <span class="Heading">Installing
</span>
</div>
</div>
<h3>5 <span class="Heading">Adding new visualization tools</span></h3
<p><a id="X7DB91A9C7C03FF67" name="X7DB91A9C7C03FF67"></a></p>
<h4>5.1 <span class="
<p>The visualization c(java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
<>are supported to do this toolsthat toavailableto usersofthispackage java.lang.StringIndexOutOfBoundsException: Range [124, 123) out of bounds for length 672
<p><a id="X858B113D80E8D32B" name="X858B113D80E8D32B"></a></p>
<h4>5.2 >
<> the ./>
<ul
<lili>p>the of thefile, willnotice that <odeclass="code">chartjs</code> as a new function in the <code class="code">window.VisualizationTools</
</li>
<li><p>// The variable theelement page
<lijava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
<li>< ///yournew does itsworkin SVG element, you needone
</e.append( )
</ul>
<p available proceed toeitherof the sections,depending intendto package with new visualization, or just install one into it at runtime.</p>
<p>// convention upto youexplain withyournew
<h4> ""- else,at respect
<p>/isanexamplefor an :
<> wish to newvisualization at runtime youryour own use in a particular project (or in a package that depends on this one), refer to the instructions in the Section <a href="chap5.html#X8434DB9C80EC7E6B"><span class="RefLink">5.4</span></ .java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 50
<java.lang.StringIndexOutOfBoundsException: Range [19, 13) out of bounds for length 361
<ol>
<li><p>Clone the repository for / library aExample
</li>
<li><p>Enter the <code class="/ Tell your library what tojava.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 52
<li>
<li><p>Duplicatecallback ,result;
</li>
<li><p>Edit that</pre</div>
<java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [29, 30) out of bounds for length 26
paths <ivclass=example">prejava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
NEWTOOL : 'https: #any data here as a GAP record
}
} ;
<pre<div>
<>
<li><java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 5
</li>
<li><p>At the end of the same file
<div class="example"><pre>
java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 74
//
/java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 71
/java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 73
var result = document.createElement herebuildscomponentsofthe
append ;
/ variable"son" allthe datainJSONform,passed
APto tell youhowto a . Thedata format
/conventionis to to explain anddocumentwith your
// tool.NEWTOOL=function( )
/ height" - ignore everythingelse,at least
/thosein whateverway makes for . Here
// is an GAP record you,storedin result.
(json. )result. =json.;
if ( json.height ) result.java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 16
// Then
// URL your loading the packageinto< class=pkg"GAP<strong a call <code class=func><code> (a =".tmlX811D60857B0B2B68< "">.1-</>a> codeclass""PlotGraphcode (< ="hap7html#"< class"".-3<span<a) thatspecifically theuseofyournewly-
// before <divclass=example"><rejava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
// you choose to establish.
([NEWTOOL , function(NEWTOOL ) {
// Use your PlotGraph( RandomMat( 5, 5 ), rec( tool := "NEWTOOL" ) );
var viz = NEWTOOL.java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 0
// Tell your library what to draw
viz.li><p>Once your changes work therepository and a requestback tothe repository,to have included default.<>
// Call
/ given,plusthe visualizationyoucreated
callback( element, resultpA complete andworking(but silly follows. is atinyenough visualization support plotting nordrawing , so ' have toinstall- support.This go codeclass/tool-.js/:/
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
};
</>
</li>
<><>, <code=">//<code>folderrun code class="ile>-allscripts/code>script yourJavaScript to savedatatransfer allocation andtime Rerunjava.lang.StringIndexOutOfBoundsException: Range [244, 243) out of bounds for length 294
</li>
<li><p>
<div class
CreateVisualization =example<re
tool := "NEWTOOL",
#
json packagewill convert intoJSON
) ) : "reen"
</pre><
</i>
</
<>At , added supportin< =func"CreateVisualization/ (<href"html"<pan class=RefLink72-<span>/)for the tool have not that java.lang.StringIndexOutOfBoundsException: Range [222, 221) out of bounds for length 572
<ol>
<li><p>Read the documentation for either <code class="func">ConvertDataSeriesForTool</code> (<a href="chap7.html#X7B36451A873E06B2"><span class="RefLink">7.1-2</span></a>) or <code class="func">ConvertGraphForTool</code> (<a href
</li>
<li><p>Edit the <code class="file">main.gi</code> file in this package. Find the section
<div class="example"><pre>
ConvertDataSeriesForTool.NEWTOOL := function ( series )
local result;
#Writethe code here that builds the ofthe
# GAP record you need, stored in result.
# You can leverage series.x<pThe previoussectionthoroughly documents two of code arelikelyto upindefinition a newtoolthe into oftoolsCDNURLandtheinto<ode =c>.VisualizationTool a usesthattool tojava.lang.StringIndexOutOfBoundsException: Range [302, 301) out of bounds for length 347
returnresult
end;
ConvertGraphForTool.
local resultdivclass"">
thecodehere thatbuildscomponents the
# GAP recordpre<div>
# You graphverticesgraph.edges, graph.ptionsjava.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
return result;
end;
</pre>/iv
<>
<li><p>Test your work by loading the updated package into <strong (element, ,callback){
<"example"<pre>
# for plots:
Plot(&t 2 rec(tool : "EWTOOL"))
# or for graphs}
PlotGraph( RandomMat( 5, 5 ), rec( tool := "NEWTOOL" )""
</pre></div> GAP to use thatnew visualization:
<p>Verifytext :=" show ed.
</li>
<li><p>Once your changes work, commit/pre>/>
</li>
</ol>
<p>A complete and working (but silly
<div class="example"InstallVisualizationToolFr(""
/Noneed to any fromaCDNfor this .
window.callback( elementchildNodes[]);
// just writes json.text in json.color, that's all
span=documentcreateElement'span')
.extContent .;
span.style.color = json
callback(element ;
};
</pre></div( "canvasjs,
<p>This is an example usage of that ""
<div class="example"><pre>
CreateVisualization rec(
="",
text : Happy.' ."
color );
);
</pre></div>
<<=X8434DB9C80EC7E6B"java.lang.StringIndexOutOfBoundsException: Range [54, 52) out of bounds for length 62
<h4>5.4 <span class="Heading">Installing
<p>This section explains how to add a new
<p>If you have a visualization java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 0
<p>To install a new visualization tool at runtime, you have two methods available. You canbody
<p>The previous section thoroughly documents the two types of code that are likely to show up in the definition of a new tool: the installation into RequireJS of the tool's CDN URL and the installation into <code class="code">window.VisualizationTool</code> of a function that uses that tool to create a visualization from a given JSON object.</p>
<p>If you have all of this JavaScript code already stored in a single GAP string (or in a file that you can load into a string), call it <code class="code">S</code>, then you can install it into this package with a single function call, like so:</p>
<div class="example"><pre>
InstallVisualizationTool( "TOOL_NAME_HERE", S );
</pre></div>
<p>Here is a trivial working example. It is sufficiently small that it does not install any new JavaScript libraries into RequireJS.</p>
<div class="example"><pre>
# GAP code to install a new visualization tool:
InstallVisualizationTool( "smallExample",
"""
window.VisualizationTool.smallExample =
function ( element, json, callback ) {
element.innerHTML = '<span color=red>' + json.text + '</span>';
callback( element, element.childNodes[0] );
}
"""
) );
# GAP code to use that new visualization tool:
CreateVisualization( rec(
tool := "smallExample",
text := "This text will show up red."
) );
</pre></div>
<p>Because the assignment of a function to create visualizations from JSON is the essential component of installing a new visualization,
<div class="example"><pre>
InstallVisualizationToolFromTemplatejava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 6
"""
element. =<color&' +t +'&/gt;java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
callback( element, element.childNodes[0] );
"""
) );
</pre></div>
<p>If you provide a third parametr to <code class="func">InstallVisualizationToolFromTemplate</code> (<a href="chap7.html#X876DFB2B87FC3732"><span class="RefLink">7.2-4</span></a>), it is treated as the CDN URL for an external library, and java.lang.StringIndexOutOfBoundsException: Index 243 out of bounds for length 56
<div class="example"><pre>
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
"""
( new window.CanvasJS.Chart( element, json.data ) ).render();
.resizeToShowContents ;
callbackjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
""",
"https://cdnjs.cloudflare.com/ajax/libs/canvasjs/1.7.0/canvasjs.min.js"
</pre></div>
<pWhile thatyou omit the <code class="code">.js</code> suffix from such an URL, <code class="func">InstallVisualizationToolFromTemplate</code> (/span>
<p>After using either of those two methods, if the new visualization tool is capable of <span>
<div class="chlinkprevnextbot"> <a href="chap0.html">[Top of Book]</a> <a href="chap0.html#contents">[Contents]</a> </iv>
<div class="chlinkbot"><span class="chlink1">Goto java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 7
<hr />
<p java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 0
</body>
</html>
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.14Bemerkung:
¤
*Bot Zugriff
|
|
2026-11-01
|
|
|
|
|
Neuigkeiten |
| Aktuelles |
| Motto des Tages |
|
Open Source Software |
|
|
|
Jenseits des Üblichen ....
|
|
Besucherstatistik |
|
|
| Statistik |
| #Sources=1104846 |
| #Domains=499270 |
|
|