Serenity: Can't find the origin of data in the charts

Created on 16 Aug 2017  路  7Comments  路  Source: serenity-is/Serenity

Hi everyone !

I'm currently adapting the dashboard to my project, and I wanted to edit the "Sales" graph. Problem : impossible to find where the data used in order to make the graphic are. Any idea ?

I'm talking about this graph :

<section class="col-lg-7 connectedSortable">
        <!-- Custom tabs (Charts with tabs)-->
        <div class="nav-tabs-custom">
            <!-- Tabs within a box -->
            <ul class="nav nav-tabs pull-right">
                <li class="active"><a href="#revenue-chart" data-toggle="tab">Area</a></li>
                <li><a href="#sales-chart" data-toggle="tab">Donut</a></li>
                <li class="pull-left header"><i class="fa fa-inbox"></i> Sales</li>
            </ul>
            <div class="tab-content no-padding">
                <!-- Morris chart - Sales -->
                <div class="chart tab-pane active" id="revenue-chart" style="position: relative; height: 300px;"></div>
                <div class="chart tab-pane" id="sales-chart" style="position: relative; height: 300px;"></div>
            </div>
        </div><!-- /.nav-tabs-custom -->
    </section><!-- right col -->
</div><!-- /.row (main row) -->

Most helpful comment

I have a sample that shows the implementation of the charts using the basic samples chart in dialog.

https://github.com/sayuga/AdminLTE-Widgets-in-Typscript/tree/master/Charts

You'll have to create a service call to get the data for the chart. The data being used in the current dashboard samples is being fed through a scrip that is holding dummy data in a .js file so it'd be useless to adapt that end.

I've gotten most of the Dashboard widgets rebuilt in my repository so you are welcome to use that as a starting point. I haven't finished them due to another project taking priority but let me know if you need more help.

All 7 comments

If you are using Visual Studio in English, Ctrl-F is useful to search stuff.
The data is hardcoded as an example. The file is Scriptsadminltepagesdashboard.js
If you want to load data, then you can follow the example of the KPIs. It's basically the same.
This is what I did to put some simple data in the donut and the bar chart:

In the DashboardIndex.cshtml

<script type="text/javascript">
    jQuery(function () {

        //This is if we use typescript to load the chart.
        // the info looks like hidden.
        ProjectName.Common.DashboardChart.initializeChart();
    });
</script>

In a new file named DashboardChart.ts

        static initializeChart() {
            $(function () {

                Common.DashboardPageService.CountByStatus({}, response => {
                    this.areaChart = new Morris.Bar({
                        element: 'revenue-chart',
                        resize: true, parseTime: false,
                        data: response.Values,
                        xkey: 'Month',
                        ykeys: response.StatusKeys, labels: response.StatusLabels, hideHover: 'auto'
                    });
                });

What I did was to follow the example of the Chart In Dialog.
FYI. I'm not a web developer so these examples may not be the best way of doing it.

Also, search the forum (ctrl-f), someone shared some examples of how to correctly implement this.

Gus

I have a sample that shows the implementation of the charts using the basic samples chart in dialog.

https://github.com/sayuga/AdminLTE-Widgets-in-Typscript/tree/master/Charts

You'll have to create a service call to get the data for the chart. The data being used in the current dashboard samples is being fed through a scrip that is holding dummy data in a .js file so it'd be useless to adapt that end.

I've gotten most of the Dashboard widgets rebuilt in my repository so you are welcome to use that as a starting point. I haven't finished them due to another project taking priority but let me know if you need more help.

Hey @sayuga Thank you!! this was the example I was talking about! awesome stuff!

Gus.

@gguadalupe , If your issue is resolved, please close the issue.

Hi @sayuga, this is not mine. It's @DoeJowns

Gus.

Oops. My mistake. @DoeJowns then. If you are all set please remember to close the ticket.

Sorry @gguadalupe

@sayuga thanks ,your example is very useful fro me .

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JohnRanger picture JohnRanger  路  3Comments

moostafaa picture moostafaa  路  3Comments

newyearsoft picture newyearsoft  路  3Comments

stepankurdylo picture stepankurdylo  路  3Comments

Akarsh03 picture Akarsh03  路  3Comments