人力车:如何翻译几个月?

时间:2014-04-30 04:12:33

标签: d3.js rickshaw

我试图获取人力图的工具提示信息,其中数字和日期形成为欧洲大陆,西班牙语为几个月,西班牙语为几天。

有关如何将月份名称和日期名称翻译为西班牙语的任何线索,以及如何实施它?

由于

更新获得此文件。 Rickshaw.Fixtures.Time.js和Rickshaw.Fixtures.Time.Local.js翻译只是为了看看是否有效但没有结果或我不知道如何实现这些。

12/08/2013  03:39 a.m.            17.514 d3.layout.min.js
    12/08/2013  03:39 a.m.            57.228 d3.min.js
    12/08/2013  03:39 a.m.           239.674 d3.v2.js
    28/04/2014  12:40 p.m.           144.719 d3.v3.js
    12/08/2013  03:39 a.m.             2.881 extensions.js
    01/05/2014  02:35 a.m.                 0 files.txt
    17/11/2013  04:48 p.m.            90.656 raphael-min.js
    12/08/2013  03:39 a.m.             6.446 Rickshaw.Class.js
    12/08/2013  03:39 a.m.             1.437 Rickshaw.Color.Palette.js
    12/08/2013  03:39 a.m.             3.523 Rickshaw.Compat.ClassList.js
    12/08/2013  03:39 a.m.             2.178 Rickshaw.Fixtures.Color.js
    12/08/2013  03:39 a.m.             1.105 Rickshaw.Fixtures.Number.js
    12/08/2013  03:39 a.m.               916 Rickshaw.Fixtures.RandomData.js
    30/04/2014  12:34 a.m.             2.683 Rickshaw.Fixtures.Time.js
    30/04/2014  12:38 a.m.             2.683 Rickshaw.Fixtures.Time.Local.js
    12/08/2013  03:39 a.m.             1.486 Rickshaw.Graph.Ajax.js
    12/08/2013  03:39 a.m.             3.018 Rickshaw.Graph.Annotate.js
    12/08/2013  03:39 a.m.             1.907 Rickshaw.Graph.Axis.Time.js
    12/08/2013  03:39 a.m.             3.047 Rickshaw.Graph.Axis.X.js
    12/08/2013  03:39 a.m.             2.909 Rickshaw.Graph.Axis.Y.js
    12/08/2013  03:39 a.m.               824 Rickshaw.Graph.Axis.Y.Scaled.js
    12/08/2013  03:39 a.m.             1.920 Rickshaw.Graph.Behavior.Series.Highlight.js
    12/08/2013  03:39 a.m.             1.058 Rickshaw.Graph.Behavior.Series.Order.js
    12/08/2013  03:39 a.m.             3.757 Rickshaw.Graph.Behavior.Series.Toggle.js
    12/08/2013  03:39 a.m.             5.369 Rickshaw.Graph.HoverDetail.js
    12/08/2013  03:39 a.m.             6.760 Rickshaw.Graph.js
    12/08/2013  03:39 a.m.               279 Rickshaw.Graph.JSONP.js
    12/08/2013  03:39 a.m.             1.383 Rickshaw.Graph.Legend.js
    12/08/2013  03:39 a.m.             1.534 Rickshaw.Graph.RangeSlider.js
    12/08/2013  03:39 a.m.             2.189 Rickshaw.Graph.Renderer.Area.js
    12/08/2013  03:39 a.m.             2.838 Rickshaw.Graph.Renderer.Bar.js
    12/08/2013  03:39 a.m.             3.714 Rickshaw.Graph.Renderer.js
    12/08/2013  03:39 a.m.               633 Rickshaw.Graph.Renderer.Line.js
    12/08/2013  03:39 a.m.             2.070 Rickshaw.Graph.Renderer.LinePlot.js
    12/08/2013  03:39 a.m.             2.871 Rickshaw.Graph.Renderer.Multi.js
    12/08/2013  03:39 a.m.             1.174 Rickshaw.Graph.Renderer.ScatterPlot.js
    12/08/2013  03:39 a.m.               692 Rickshaw.Graph.Renderer.Stack.js
    12/08/2013  03:39 a.m.             1.364 Rickshaw.Graph.Smoother.js
    12/08/2013  03:39 a.m.               417 Rickshaw.Graph.Unstacker.js
    12/08/2013  03:39 a.m.               756 Rickshaw.js
    12/08/2013  03:39 a.m.            61.096 rickshaw.min.js
    12/08/2013  03:39 a.m.             2.147 Rickshaw.Series.FixedDuration.js
    12/08/2013  03:39 a.m.             3.291 Rickshaw.Series.js

此图表的代码加载。

function grafica(){


    graph =  new Rickshaw.Graph.Ajax( {
            element: document.getElementById("rickshaw"),

            height: 200,
            renderer: 'line',
            dataURL: 'data.json',
            onData: function(d) { d[0].data[0].y = 80; return d },
     onComplete: function(transport) {
                var graph = transport.graph;
                var detail = new Rickshaw.Graph.HoverDetail({ graph: graph });
                var xAxis = new Rickshaw.Graph.Axis.Time({graph: graph });
                xAxis.render();
                var yAxis = new Rickshaw.Graph.Axis.Y( {
                graph: graph,
                tickFormat: Rickshaw.Fixtures.Number.formatKMBT,
                ticksTreatment: ticksTreatment
                });
                var legend = new Rickshaw.Graph.Legend( {
                graph: graph,
                element: document.getElementById('legend')
                }); 

                yAxis.render();
                var shelving = new Rickshaw.Graph.Behavior.Series.Toggle( {
                graph: graph,
                legend: legend
                } );

                var order = new Rickshaw.Graph.Behavior.Series.Order( {
                graph: graph,
                legend: legend
                } );

                var highlighter = new Rickshaw.Graph.Behavior.Series.Highlight( {
                graph: graph,
                legend: legend
                } );    
            },
            series: [
                {
                    name: 'Positiva',
                    color: '#0aa699'
                }, {
                    name: 'Negativa',
                    color: '#f35958'
                }, {
                    name: 'Todos',
                    color: '#6060c0'
                }
            ]
        } );
    var ticksTreatment = 'glow';
    }

1 个答案:

答案 0 :(得分:0)

因为我不是一个JS专业人士,所以我不会帮你翻译这些东西。但我知道你必须在哪里使用它:

graph =  new Rickshaw.Graph.Ajax( {
        ....
 onComplete: function(transport) {
            var graph = transport.graph;
            var detail = new Rickshaw.Graph.HoverDetail({ graph: graph });
            ...
        },
...        } );
var ticksTreatment = 'glow';
}

您正在寻找的神奇部分是:

                var detail = new Rickshaw.Graph.HoverDetail({ graph: graph });

您可以添加xFormatter和yFormatter

var hoverDetail2 = new Rickshaw.Graph.HoverDetail({graph: graph,
    xFormatter: function(x) {ConvertHowever you Like},
    yFormatter: function(y) {ConvertHowever you Like}
});

确保在x和yFormatter中返回一个值。当您将鼠标悬停时,您返回的值将显示为工具提示。

希望这有助于