d3.js价格和日期的变更格式

d3.js价格和日期的变更格式,d3.js,crossfilter,dc.js,D3.js,Crossfilter,Dc.js,我想更改d3.js中的日期和数字格式 我使用下面的代码生成图表 collectionRate.width(940) .height(250) .dimension(collectionRateValue) .group(collectionRateValueGroup_payment, "Payment") //.stack(collectionRateValueGroup_adj, "count") .stack(collectionRateValueG

我想更改d3.js中的日期和数字格式

我使用下面的代码生成图表

collectionRate.width(940)
    .height(250)
    .dimension(collectionRateValue)
    .group(collectionRateValueGroup_payment, "Payment")
    //.stack(collectionRateValueGroup_adj, "count")
    .stack(collectionRateValueGroup_ar_bal, "charge amt")
    .title(function(d) {
        return  ": ";
    })
    .renderTitle(true)
    .transitionDuration(1500)
    .margins({
        top: 10, 
        right: 50, 
        bottom: 30, 
        left: 70
    })
    .centerBar(true)
    .gap(10)
    .xAxisPadding(500)
    .xUnits(d3.time.months)
    .label(function(d){
        return "d.key";
    })
    .round(d3.time.month.round)
    .x(d3.time.scale().domain([new Date(2012, 11, 1), new Date(2013, 12, 31)]))
    //.x(d3.scale.linear().domain([-1, 10000]))
    .legend(dc.legend().x(750).y(0))
    .elasticY(true)


    dc.renderAll();
    dc.redrawAll();
    d3.select("#dc-pie-graph > svg > g").attr("transform", "translate(100,100)"); 
代码的结果如下

现在,我想要什么 我想将Y轴值格式从500000更改为50K,与其他相同。 当前,X轴值为1月、2月。。。。我想把它改成1月13日

我已经尝试过了,但我无法成功地改变格式

您可以使用来执行此操作,例如,对于x轴:

.xAxis().tickFormat(d3.time.format("%b-%d"));
您当前正四舍五入到整月(
.round(d3.time.month.round)
),您可能希望为此删除这些月份。对于y轴,它看起来像这样:

.yAxis().tickFormat(d3.format(",.0s"));