Giter VIP home page Giter VIP logo

Comments (4)

sht5 avatar sht5 commented on July 17, 2024 1
/**
 * Created by shahartaite on 05/01/2017.
 */

import React, {Component} from 'react';
const AmCharts = require('amcharts3-react');

class StatusGantt extends Component {

  render() {

    const ganttConfig = {
      "height" :"500",
      "type": "gantt",
      "theme": "light",
      "marginRight": 70,
      "period": "DD",
      "dataDateFormat": "YYYY-MM-DD",
      "columnWidth": 0.5,
      "valueAxis": {
        "type": "date"
      },
      "brightnessStep": 7,
      "graph": {
        "lineAlpha": 1,
        "lineColor": "#fff",
        "fillAlphas": 0.85,
        "balloonText": "<b>[[task]]</b>:<br />[[open]] -- [[value]]"
      },
      "rotate": true,
      "categoryField": "category",
      "segmentsField": "segments",
      "colorField": "color",
      "startDateField": "start",
      "endDateField": "end",
      "dataProvider": [ {
        "category": "Module #1",
        "segments": [ {
          "start": "2016-01-01",
          "end": "2016-01-14",
          "color": "#b9783f",
          "task": "Gathering requirements"
        }, {
          "start": "2016-01-16",
          "end": "2016-01-27",
          "color": "#000000",
          "task": "Producing specifications"
        }, {
          "start": "2016-02-05",
          "end": "2016-04-18",
          "task": "Development"
        }, {
          "start": "2016-04-18",
          "end": "2016-04-30",
          "task": "Testing and QA"
        } ]
      }, {
        "category": "Module #2",
        "segments": [ {
          "start": "2016-01-08",
          "end": "2016-01-10",
          "color": "#cc4748",
          "task": "Gathering requirements"
        }, {
          "start": "2016-01-12",
          "end": "2016-01-15",
          "task": "Producing specifications"
        }, {
          "start": "2016-01-16",
          "end": "2016-02-05",
          "task": "Development"
        }, {
          "start": "2016-02-10",
          "end": "2016-02-18",
          "task": "Testing and QA"
        } ]
      }, {
        "category": "Module #3",
        "segments": [ {
          "start": "2016-01-02",
          "end": "2016-01-08",
          "color": "#cd82ad",
          "task": "Gathering requirements"
        }, {
          "start": "2016-01-08",
          "end": "2016-01-16",
          "task": "Producing specifications"
        }, {
          "start": "2016-01-19",
          "end": "2016-03-01",
          "task": "Development"
        }, {
          "start": "2016-03-12",
          "end": "2016-04-05",
          "task": "Testing and QA"
        } ]
      }, {
        "category": "Module #4",
        "segments": [ {
          "start": "2016-01-01",
          "end": "2016-01-19",
          "color": "#2f4074",
          "task": "Gathering requirements"
        }, {
          "start": "2016-01-19",
          "end": "2016-02-03",
          "task": "Producing specifications"
        }, {
          "start": "2016-03-20",
          "end": "2016-04-25",
          "task": "Development"
        }, {
          "start": "2016-04-27",
          "end": "2016-05-15",
          "task": "Testing and QA"
        } ]
      }, {
        "category": "Module #5",
        "segments": [ {
          "start": "2016-01-01",
          "end": "2016-01-12",
          "color": "#448e4d",
          "task": "Gathering requirements"
        }, {
          "start": "2016-01-12",
          "end": "2016-01-19",
          "task": "Producing specifications"
        }, {
          "start": "2016-01-19",
          "end": "2016-03-01",
          "task": "Development"
        }, {
          "start": "2016-03-08",
          "end": "2016-03-30",
          "task": "Testing and QA"
        } ]
      } ],
      "valueScrollbar": {
        "autoGridCount": true
      },
      "chartCursor": {
        "cursorColor": "#55bb76",
        "valueBalloonsEnabled": false,
        "cursorAlpha": 0,
        "valueLineAlpha": 0.5,
        "valueLineBalloonEnabled": true,
        "valueLineEnabled": true,
        "zoomable": false,
        "valueZoomable": true
      },
      "export": {
        "enabled": true
      }
    };
    return (
      <AmCharts {...ganttConfig}/>
    );
  };
}
export default StatusGantt;

from amcharts3-react.

sht5 avatar sht5 commented on July 17, 2024

this happenned to me as well, i changed all require statements, put script tags instead:

<script src="https://www.amcharts.com/lib/3/amcharts.js"></script> <script src="https://www.amcharts.com/lib/3/serial.js"></script> <script src="https://www.amcharts.com/lib/3/gantt.js"></script> <script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script> <script src="https://www.amcharts.com/lib/3/themes/light.js"></script>

and it worked.
followed this jsbin, i think the problem was mostly the missing gantt.js file.
http://jsfiddle.net/api/post/library/pure/

from amcharts3-react.

adamcee avatar adamcee commented on July 17, 2024

Thanks very much @sht5 ! A teammate also came to that conclusion. Got it working.

FYI, the jsfiddle link you posted appears to be empty. However the code you posted is spot-on.

As a general note which may be of use to others, and to @Pauan , I initially tried to require('amcharts3/amcharts/gantt.js') (similarly to how, in the demo code for serial charts, serial.js is required, however the JSX compiler then throws an error on line 44 of gantt.js. However, when including gantt.js from amcharts.com as a script, it works fine.

from amcharts3-react.

Pauan avatar Pauan commented on July 17, 2024

@adamcee Sorry for the delay.

You should configure your JSX compiler so that it ignores any files inside of node_modules, then you should be able to use require('amcharts3/amcharts/gantt.js')

from amcharts3-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.