Javascript线条图到条形图

Javascript线条图到条形图,javascript,graph,charts,d3.js,graphael,Javascript,Graph,Charts,D3.js,Graphael,在大学的一个项目中,我使用gRaphael创建了以下线条图,但我想使用除google charts之外的任何库将其更改为条形图 我试着用gRaphael来做,但gRaphel网站上所有的柱状图示例都没有axis!!!他们觉得很奇怪 我需要做的是显示完全相同的内容,但使用折线图而不是条形图。我没想到会这么难 我还看到了d3js库,它看起来非常好,但我不知道如何在那里转换代码,因为当用户将鼠标悬停在一个条上时,应该能够看到它的值。我在d3js条形图上找不到这个悬停函数 通常,此折线图的作用是在x轴显

在大学的一个项目中,我使用gRaphael创建了以下线条图,但我想使用除google charts之外的任何库将其更改为条形图

我试着用gRaphael来做,但gRaphel网站上所有的柱状图示例都没有axis!!!他们觉得很奇怪

我需要做的是显示完全相同的内容,但使用折线图而不是条形图。我没想到会这么难

我还看到了d3js库,它看起来非常好,但我不知道如何在那里转换代码,因为当用户将鼠标悬停在一个条上时,应该能够看到它的值。我在d3js条形图上找不到这个悬停函数

通常,此折线图的作用是在x轴显示日期,在y轴显示值。由于gRaphael不接受日期作为值,我所做的是代替日期,设置1、2、3等,以便gRaphael创建图表,然后更改x轴上的标签以显示实际日期。此外,当用户将鼠标悬停在某个点上时,应该能够看到它的值

所以,显示轴,带日期的轴,和悬停是我从潜力图中想要的

有谁能给我一些建议,或者在graphael barchart或任何其他像d3js这样的免费图表库中帮助我做到这一点

<script>
        window.onload = function () {
            var r = Raphael("holder"),
                txtattr = { font: "20px sans-serif" };

            var lines = r.linechart(80, 30, 600, 400,[1,2,3,4,5],[1.34,3.43,2.52,2.63,3.12], {type:"soft", axisxstep : 13,nostroke: false, axis: "0 0 1 1", symbol: "circle", smooth: false }).hoverColumn(function () {
                this.tags = r.set();
                for (var i = 0, ii = this.y.length; i < ii; i++) {
                    this.tags.push(r.tag(this.x, this.y[i], Number(this.values[i]).toPrecision(5), 160, 10).insertBefore(this).attr([{ fill: "#fff" }, { fill: this.symbols[i].attr("fill") }]));
                }
            }, function () {
                this.tags && this.tags.remove();
            });
            var date = new Date(1356998400000);
            var someDate = new Date(date);

            //For the x axis
            $.each(lines.axis[0].text.items , function ( index, label ) {
                //Has all the initial x values we got from the beginning as a date
                //We get the corresponding date from the value x
                //i.e. for value 3 we get 3/6/2014
                //This function replaces the values we had (numbers 1,2,3...) with the corresponding date
                someDate = new Date(date);
                someDate.setDate(date.getDate() );
                var jan312009 = new Date(2009, 1-1, 31);
                var newDate = new Date(new Date(someDate).setMonth(jan312009.getMonth()+Number(label.attr("text"))));
                var dd = newDate.getDate();
                var mm = newDate.getMonth() + 1;
                var y = newDate.getFullYear();
                var someFormattedDate = mm + '-'+ y;
                label.attr({'text': someFormattedDate});
            });
            lines.symbols.attr({ r: 6 });
        };
    </script>

非常感谢你看到了吗?哇!!!!我不知道他们。他们真是太可怕了!非常感谢LarsKotthoff。它不仅有一些非常酷的图表,实际上我也找到了我想要的。这正是我想要的