|
|
|
|
Quelle 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"></ script>
< script type= "text/javascript">overwriteStyle();</ script>
</ head>
< body class= "chap5" onload= "jscontent()">
< div class= "chlinktop">< span class= "chlink1">Goto Chapter: </ span>< a href= "chap0.html">Top</ a> < a href="chap1.html">1</a> <a href="chap2.html">2</a> <a href="chap3.html">3</a> <a href="chap4.html">4</a> <a href="chap5.html">5</a> <a href="chap6.html">6</a> <a href="chap7.html">7</a> <a href="chapInd.html">Ind</a> </div>
<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> <a href="chap6.html">[Next Chapter]</a> </div>
<p id="mathjaxlink" class="pcenter"><a href="chap5_mj.html">[MathJax on]</a></p>
<p><a id="X81249ADA79916213" name="X81249ADA79916213"></a></p>
<div class="ChapSects"><a href="chap5.html#X81249ADA79916213">5 <span class="Heading">Adding new visualization tools</span></a>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap5.html#X7DB91A9C7C03FF67">5.1 <span class="Heading">Why you might want to do this</span></a>
</span>
</div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap5.html#X858B113D80E8D32B">5.2 <span class="Heading">What you will need</span></a>
</span>
</div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap5.html#X7E5726AC788EADCC">5.3 <span class="Heading">Extending this package with a new tool</span></a>
</span>
</div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap5.html#X8434DB9C80EC7E6B">5.4 <span class="Heading">Installing a new tool at runtime</span></a>
</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="Heading">Why you might want to do this</span></h4>
<p>The visualization tools made available by this package (Plotly, D3, CanvasJS, etc.) provide many visualization options. However, you may come across a situation that they do not cover. Or a new and better tool may be invented after this package is created, and you wish to add it to the package.</p>
<p>There are two supported way to do this. First, for tools that you wish to be available to all users of this package, you can alter the package code itself to include the tool. (Then please create a pull request so that your work might be shared with other <strong class="pkg">GAP</strong> users in a subsequent release of this package.) Second, for tools that you need for just one project or just one other package, there is support for installing such tools at runtime. This chapter documents both approaches, each in its own section. But first, we begin with the list of what you will need to have on hand before you begin, which is the same for both approaches.</p>
<p><a id="X858B113D80E8D32Bscript type="text/javascript">overwriteStyle();</script>
<h4>5.2 <span class="Heading">What you will need</span></h4>
<p>Begin by gathering the following information.</p>
<ul>
<li><p>A URL on the internet that serves the /head
</li>
<li><p>Knowledge of how to write a short JavaScript function that can embed the given tool into any given
</li>
<li><p>While not necessary, it makes things java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 0
</li>
</ul>
<p>With this information available, proceed to either of the next two sections, depending on whether you intend to upgrade this package itself with a new visualization, or just install one into it at runtime.</p>
<p><a id="X7E5726AC788EADCC" name="X7E5726AC788EADCC"></a><< id=X81249ADA79916213" =X81249ADA79916213"</>/
<h4>5.3 <span class="Heading">Extending this package with a new tool</span></h4>
<p>This section explains how to enhance this package itself. If you follow these instructions, you/span>
<p>If instead you wish to install a new visualization at runtime for just your own use in a particular project/span>
<p>Throughoutjava.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 7
<ol>
<li><p>Clone the repository for this package.</p>
</li>
<li><p>Enter the <code class="file">java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 7
</li>
<li><p>Duplicate the file <code class=java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
</li>
<li><p>Edit that file
<div class="example"><prejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
window.requirejs.onfig( {
paths : {
NEWTOOL : 'https://cdn.example.com/NEWTOOL.min.js'
}
} )<There are two way tothis. First,fortools you wish be to all ,you can alter the package code itself to include the tool. (Then please create a java.lang.StringIndexOutOfBoundsException: Index 205 out of bounds for length 0
div
</li>
<li><>egin bygathering the followinginformation</>
</li>
<<>Attheend of same file,you will code installs<ode java.lang.StringIndexOutOfBoundsException: Range [83, 82) out of bounds for length 289
<div class="example"><pre>
window.VisualizationTools.NEWTOOL = function ( element, json, callback ) {
"element" is HTML intheinto
//>
//your toolkit work inanSVG element,so :
var result
lement.append(result;
// The >With this information, of thenexttwo sections,depending on whether you intend toupgradethis itselfwithajava.lang.StringIndexOutOfBoundsException: Range [154, 153) out of bounds for length 212
//
convention isup to anddocumentwith new
/
/and height -ifyouignore everythingelse atleastrespect
//
/ an example for an SVG:
ifpIfinsteadyouwish installa at runtimeforjust java.lang.StringIndexOutOfBoundsException: Range [79, 78) out of bounds for length 284
if(json.eight ) result.width = json.height;
// Then use RequireJS to import your toolkit (which will use the CDN
// URL you registered above) and use it to fill the element with the
// desired visualization. You may or may not need to modify "json"
// before passing it to your toolkit; this is up to the conventions
// you choose to establish.
require( [ '<>Throughout these steps, I will assume that the name of the new tool you wish to install is <code class="code">NEWTOOL</code>
/ Use your library to setup visualization. :
var viz = NEWTOOL.java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 0
/ draw. Example:
viz.buildVisualizationFromJSON( json );
// Call the callback when you're done. Pass the element you were
/li
(element );
} );
}java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
</>>
</li>
<li><
</li>
<li><p>You should now be able
< class""<>
CreateVisualization( rec(
tool := "NEWTOOL",
#anyotheryouneed goes asaGAP,
# which the GAP json package}
)})
<//><div
<//li
</ol>
<p>At this point, you have added support in <code java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 0
<ol>
<li><p>Readjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
</li>
<li><p>Edit thewindow.VisualizationTools.NEWTOOL = function ( element, json, callback ) {
<div class//which you should place your visualization. For example, perhaps
ConvertDataSeriesForTool.NEWTOOL := function ( series )
local / your new toolkit does its work in an SVG element, so you need one:
#Write the codehere that the components of the
# GAP recordelement.(result);
/The "sonis the data, in form from
// G tell you create visualization data
end;/ convention is up to you with new
ConvertGraphForToolNEWTOOL : function (graph)
/ and"eight -if you else,respect
# / in whatever makessense yourvisualizationHere
# need in
# You can leverageif jsonwidth)resultwidth =jsonwidth
return result;
end;
</pre></div>
<>
<your work by loadingthe updatedpackage strong=pkg><>and makinga to <codeclass""Plot<code<href"hap7h#">spanclass=RefLink>11/pan</>or< =func></><href="hap7.tmlX79FCD4E67FF49A5F>spanclass=RefLink">13/>/a>) requests supported visualization tool.</p>
< class="><re>
# for plots:
Plot( x -> x^2, rec( tool := "NEWTOOL" ) );
# require( ['NEWTOOL'] (NEWTOOL) {
java.lang.StringIndexOutOfBoundsException: Range [23, 9) out of bounds for length 57
</pre></div>
<p>Verify that it produces the desired results.</p>
</li>
<, commit themto repository submita pullrequest back original repository, to yourwork in thedefault distribution<p>
</li// given,plus you .
</ol>
<> complete working (but )examplefollows. It a enough toolthatitcannotsupport either data drawinggraphsso we donthave highlevelAPI portionwouldgoin< class="file">libjs/viz--olor</ode>:/>
<div class="example"><pre>
// No need to import any library from } );
window.VisualizationTools.color = function ( element, json, callback ) {
// just<pre><div>
var li>pOptionally in the <code class"ile"libjs< , runthe< =f">inifyall-scripts.sh< ,which compresses JavaScript code save on ,memory allocation,and parsing time. that script each time you change your file as well.</p>
span.textContent = json.text;
span.style.color = json.color;
callback( element, span );
};
</pre></div>
<p
<div class"example"><re>
CreateVisualization( rec(
tool := "color",
text :#whichtheGAPjson will convert
color : "reen"
) );
</pre></div>
<<i>
<p> thispointyou have code class"><code> (< =chap7.#X7BFFD8B7808F5BDA"<=">7.-/>/>)fornew toolbut notextended that support to include the high-level functions <code class="func">Plot</code> (<a href="chap7.html#X811D60857B0B2B68"><span class="RefLink">7.1-1</span></a>) or <<
<p>This section explains how to add a new visualization tool to this package at runtime, by calling functions built into the package. This is most useful when the visualization tool you wish to install is useful in only a narrow context, such as one of your projects or packages.</p>
<p>If you have a visualization tool that might be of use to anyone whojava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<p>To#Write buildsthe components of
<>The the twotypesof thatare toshow the of a tool: the installationinto RequireJS the ' and the installation into <class="ode"window</code>of function that uses create a visualization from a given JSON object.</p>
<p>If you have all of this JavaScript ;
< class=example">pre>
InstallVisualizationTool( " #Writethe herethat the of
</>/div
< #You canleverage., .edges,and graphoptions.
<div class="example"><pre>
# GAP/pre>/iv>
InstallVisualizationTool( "smallExample",
"""
window.VisualizationTool<lijava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
function element,json java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
div class=>pre
callbackPlot x -g;x^,rec : N ;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
"
) );
#GAPcode usethat new tool
CreateVisualization( rec(
:=Thistextwillshowup redred"
) )java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<pre>div
<p>Because the java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
<div class="example
omTemplate smallExample,
"""
element. No toimportanylibraryfrom for this little example
, element.hildNodes0 java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
"""
) );
</var =.( ;
<pspan. =jsontext
<div classcallback( ,span)
InstallVisualizationToolFromTemplate"java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
""
( new window.CanvasJS.java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 0
window.resizeToShowContents( rec
tool: color,
="appy St.PatricksDay."
"https://cdnjs.cloudflare.com/ajax/libs/canvasjs/1.7.0/canvasjs.min.js"
) )
</pre))java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
<p>Whilep>a id"X8434DB9C80EC7E6B" name="X8434DB9C80EC7E6B"></a></p>
<p>After using either of those twojava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<div class="chlinkprevnextbot">&java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 0
<div class="chlinkbot"
<hr />
<p class="foot">generated by <a href="http://www.math.rwth-aachen.de/~Frank.Luebeck
</>
</html>
¤ Dauer der Verarbeitung: 0.14 Sekunden
¤
*© Formatika GbR, Deutschland
|
|
2026-11-01
|
|
|
|
|
Neuigkeiten |
| Aktuelles |
| Motto des Tages |
|
Open Source Software |
|
|
|
Jenseits des Üblichen ....
|
|
Besucherstatistik |
|
|
| Statistik |
| #Sources=1104846 |
| #Domains=499270 |
|
|