Question

J'ai ce bogue étrange dans mon code. Lorsque j'utilise des amchats et que j'essaie d'afficher le pourcentage sur chaque colonne, chaque colonne est de 100,00%.

AmCharts.ready(function () {
    $.ajax({
        url: 'Analytics/GetDivergenceByApp?appid=46',
        type: 'POST',
        contentType: 'application/json;',
        //data: JSON.stringify({ id: checkId }),
        success: function run(dataset) {
            // RADAR CHART
            chart = new AmCharts.AmSerialChart();
            chart.dataProvider = dataset;
            chart.categoryField = "col";
            chart.startDuration = 1;
            chart.sequencedAnimation = false;


            var categoryAxis = chart.categoryAxis;
            categoryAxis.gridPosition = "start";

            // VALUE AXIS
            var valueAxis = new AmCharts.ValueAxis();
            valueAxis.axisAlpha = 0.15;
            valueAxis.minimum = 0;
            valueAxis.dashLength = 3;
            valueAxis.stackType = "regular";
            chart.addValueAxis(valueAxis);



            // GRAPH
            var graph = new AmCharts.AmGraph();
            graph.type = "column";
            graph.labelText = "[[percents]]%";
            graph.valueField = "value";
            graph.title = "All Pushes";
            graph.fillAlphas = 0.6;
            graph.balloonText = "[[value]] os type installations";
            chart.addGraph(graph);

            // WRITE
            chart.write("chartdiv2");
        }
    });
});

J'utilise C # avec MVC4 pour obtenir les données et je dois noter qu'il apparaît bien sur le graphique. Comment puis-je résoudre ce problème pour montrer le véritable pourcentage?

Était-ce utile?

La solution

Cela ne fonctionnera pas, [[[Percents]] affiche le pourcentage du graphique d'une série, de sorte que cela ne signifie que si vous avez plus d'un graphique.Dans votre cas, vous devez calculer manuellement les valeurs pourcentage manuellement, les ajouter à vos données, avec un nom de champ personnalisé comme "percentsCalculé", puis affichez cette valeur dans une étiquette: [[percentsCalculé]]

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top