I figured out my n00b error: The initialization script needs to be at the end 
of the HTML doc. Once I did that (and also set the constraintType configuration 
property on the chart configuration), I’m now getting a visualization widget on 
my page. 

Now I just need to fill it with data….

Cheers,

E.

----
Eliot Kimber
Doer of Things Nobody Else Has Time For

On 8/7/17, 3:19 PM, "[email protected] on behalf of Eliot 
Kimber" <[email protected] on behalf of 
[email protected]> wrote:

    
    I was looking at the Google visualization stuff and then found Dave Lee’s 
paper on using it with MarkLogic, which then led me to the ML 8 docs.
    
    Note that I’m not really using the application builder, just using code 
that comes with it. I suspect my issue is just a basic JavaScript problem.
    
    I’ll take a look at vis.js—I need easy for this project…
    
    Cheers,
    
    E.
    ----
    Eliot Kimber
    Doer of Things Nobody Else Has Tme For
    
    On 8/7/17, 3:08 PM, "[email protected] on behalf of 
Erik Hennum" <[email protected] on behalf of 
[email protected]> wrote:
    
        Hi, Eliot:
        
        The AppBuilder has been superseded by initiatives in the JavaScript 
ecosystem and is deprecated in MarkLogic 8 and removed in 9.
        
        I've heard good things about the D3 (versatile) and vis.js (easy) Open 
Source JavaScript visualization libraries.
        
        
        Hoping that's useful,
        
        
        Erik Hennum
        
        ________________________________________
        From: [email protected] 
[[email protected]] on behalf of Eliot Kimber 
[[email protected]]
        Sent: Monday, August 07, 2017 12:24 PM
        To: MarkLogic Developer Discussion
        Subject: [MarkLogic Dev General] Trying to Get ML Data Visualization 
Widgets    Working
        
        Using ML 8, I’m setting up a little profiling web application and I 
need to do visualization on the recorded data, e.g., durations reported by 
query meters for a large number operations.
        
        I’m following the guidance in the Search Developer's Guide — Chapter 
31, Data Visualization Widgets, in the context of my own simple Web app (that 
is, I did not use the application builder to initially create my app, I just 
created a simple HTTP app from scratch.
        
        I’m generating an HTML page that includes all the Javascript for 
visualization:
        
            <script src="/appbuilder/lib/external/jquery-1.7.1.min.js" 
type="text/javascript"></script>
            <script src="/appbuilder/lib/external/highcharts.src.js" 
type="text/javascript"></script>
            <!-- Visualization widget scripts -->
            <script src="/appbuilder/lib/controller.js" 
type="text/javascript"></script>
            <script src="/appbuilder/lib/widget.js" 
type="text/javascript"></script>
            <script src="/appbuilder/lib/viz/chart/chart.js" 
type="text/javascript"></script>
            <script type="text/javascript">
                var durationBarChartConfig = {
        title: "Duration Distributions",
                    dataLabel: "Durations",
                    dataType: "int"
                }
                ML.controller.init();
                ML.chartWidget('duration-bar-chart-1', 'bar', 
durationBarChartConfig); ML.chartWidget('duration-bar-chart-2', 'bar', 
durationBarChartConfig); ML.chartWidget('duration-bar-chart-3', 'bar', 
durationBarChartConfig);
        
                ML.controller.loadData();
                </script>
        
        And in the main HTML I’m generating the corresponding widget-containing 
divs:
        
           <td>
              <div id="duration-bar-chart-1" class="widget"></div>
            </td>
        
        However, when I load the page I get this result in the console:
        
        chart.js:82 Uncaught Chart widget container ID "duration-bar-chart-1" 
does not exist
        
        The element exists and there are no other errors in the JS console.
        
        I assume I must be missing something basic here but as I’m not at all 
versed in JavaScript I’m hoping someone can point me in the right direction.
        
        I didn’t see anything in the ML guide or the underlying JavaScript code 
that suggested I’m missing some setup.
        
        Thanks,
        
        Eliot
        
        --
        Eliot Kimber
        http://contrext.com
        
        
        
        
        _______________________________________________
        General mailing list
        [email protected]
        Manage your subscription at:
        http://developer.marklogic.com/mailman/listinfo/general
        _______________________________________________
        General mailing list
        [email protected]
        Manage your subscription at: 
        http://developer.marklogic.com/mailman/listinfo/general
        
    
    
    
    
    
    _______________________________________________
    General mailing list
    [email protected]
    Manage your subscription at: 
    http://developer.marklogic.com/mailman/listinfo/general
    





_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to