Git Product home page Git Product logo

Comments (7)

sturdystablestalwart avatar sturdystablestalwart commented on June 2, 2024

@IgorLelyakov
It seems that there is a discrepancy between the expected keys and provided ones, I would suggest using the camel case as shown in documentation. Below is the fixed example of your data.

{
      "id": "1",
      "parent": "null",
      "name": "Проект 1",
      "baselineStart": "2023-02-01",
      "baselineEnd": "2023-12-21",
      "actualStart": "2023-02-05",
      "actualEnd": "2023-12-31",
      "progressValue": "50",
      "connectTo": "null",
      "connectorType": "null"
},

To have custom column display the baselineStart you just need to fallow the documentation on formatters and use newColumn2.labels().format('{%baselineStart}')
Thank you for your question, if any other questions will come up, don't hesitate to ask, I'm here to help.

from anychart.

IgorLelyakov avatar IgorLelyakov commented on June 2, 2024

Добрый день!
Спасибо за ответ, заменил как вы предложили.
Выдает следующую ошибку:
File "d:\Python\Projects1\templates\gant3.html", line 31, in template
newColumn2.labels().format('{%baselineStart}');
jinja2.exceptions.TemplateSyntaxError: Encountered unknown tag 'baselineStart'.

<script src="https://cdn.anychart.com/releases/8.12.0/js/anychart-core.min.js" type="text/javascript"></script> <script src="https://cdn.anychart.com/releases/8.12.0/js/anychart-gantt.min.js" type="text/javascript"></script> <script src="https://cdn.anychart.com/releases/8.12.0/js/anychart-ui.min.js" type="text/javascript"></script> <script src="https://cdn.anychart.com/releases/8.12.0/js/anychart-exports.min.js"></script> <script src="https://cdn.anychart.com/releases/v8/js/anychart-data-adapter.min.js"></script>
<script> anychart.onDocumentReady(function () {
        //var gant = anychart.fromJson({{chartData|safe}});
        var gant = {{ chartData|tojson|safe }};
        console.log('gant:', gant);

        var treeData = anychart.data.tree(gant, 'as-table');
        console.log('treeData:', treeData);

        var chart = anychart.ganttProject();
        // set data for the chart
        chart.data(treeData);
        var newColumn2 = chart.dataGrid().column(2);
        newColumn2.labels().format('{%baselineStart}');
       
        chart.container("container");  
        // initiate drawing the chart
        chart.draw();
                    
        chart.edit(true);
    });  



  </script>

from anychart.

sturdystablestalwart avatar sturdystablestalwart commented on June 2, 2024

@IgorLelyakov
I've put together a working sample for you. It seem that something interferes with normal behaviour of the chart, could you try removing any additional libraries and re-testing.
Thank you for your question, if any other questions will come up, don't hesitate to ask, I'm here to help.

from anychart.

IgorLelyakov avatar IgorLelyakov commented on June 2, 2024

Спасибо за ответ, да действительно влияет на поведение графика и ошибку, то что я использую библиотеку flask python и оператор render_template. В ней используется шаблонизатор Jinja2, в котором команды обычно обрамляются символами {%....%} ( в начале и в конце команды) и поэтому выдается ошибка, скажите можно ли по другому использовать оператор newColumn2.labels().format('{%baselineStart}'), есть ли другой способ вывода колонки или мне надо не использовать flask python?

from anychart.

sturdystablestalwart avatar sturdystablestalwart commented on June 2, 2024

@IgorLelyakov
I've never used Jinja2, but it seems that the syntax configuration there could be adjusted to your case as an example from {% foo %} to <% foo %> . Additionally I could recommend you testing some ways to devide the whole string into pieces:

var baselineStart = "%baselineStart"
newColumn2.labels().format('{'+baselineStart+'}');

from anychart.

IgorLelyakov avatar IgorLelyakov commented on June 2, 2024

Огромное спасибо, все получилось

from anychart.

sturdystablestalwart avatar sturdystablestalwart commented on June 2, 2024

Thank you for your question, if any other questions will come up, don't hesitate to ask, I'm here to help.

from anychart.

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.