а

How to make a simple horiz bar chart showing 0 -100% ?


#1

hi
Im just trying to make a simple horizontal bar chart that takes a value between 0 - 100 and fills up. its small so there are no annotations, just having the number in the middle of it 17% for example if its 17

what i get now is a mess of 2 or more things superimposed. just need the basic horizontal chart but its not working, thanks for any ideas

[code] function doOnLoad() {
amtUsed = 25;
Remaining = 100;
divisions =100;
divs = 10;
myBarChart = new dhtmlXChart({
view: “stackedBarH”,
container: “chartDiv”,
value: 100,

        color: "#1b66da",
        width: 40,

        alpha: 0.7,
        xAxis: {
            start: 0,

            end: 100
        },
        padding: {
            left:  0,
            right:  0
        },
        yAxis: {
            template: ""
        }
    });
    myBarChart.addSeries({
        value: function (obj) {
            return Remaining;
        },
        color: "#eaeaea",
        label: ""
    });
    my_data = [{ spent: amtUsed }];
    myBarChart.parse(my_data, "json");
}[/code]

#2

Hello,

If you want to get the chart with 100 total value, the following will be more correct

    [code]amtUsed = 25;
    myBarChart = new dhtmlXChart({
        view: "stackedBarH",
        container: "chartDiv",
        value: "#spent#",
        color: "#1b66da",
        width: 40,
        alpha: 0.7,
        xAxis: {
        },
        padding: {
            left:  0,
            right:  0
        },
        yAxis: {
            template: ""
        }
    });
    myBarChart.addSeries({
        value: function (obj) {
            return 100-obj.spent;
        },
        color: "#eaeaea",
        label: ""
    });
    my_data = [{ spent: amtUsed }];
    myBarChart.parse(my_data, "json");

[/code]


#3

Thank you! but I can’t figure out how to get at the labels there. the 0 part is half way in the line, so instead of be like
0 [ …bar chart…] 100%

its

([) ...bar chart...10])