-
vizulyDecember 11, 2017 at 12:09 pm #8123
Hello Emily,
Yes, you can completely override the x-axis of the line chart by providing your own.
The way you can do this is to put an event listener on the charts ‘measure’ event and then reset the xScale (or even xAxis.) This gives you a chance to update these properties before the chart is rendered. With this technique you can completely change how the scale behaves, and accommodate positive/negative/ordinal/and linear values.
So something like this (psuedo code)
myMobileLineChart.on(‘measure’,myMeasureFunction); function myMeasureFunction() { var myScale = d3.scale.linear(); // Set appropriate range and domain per your custom values myScale.range([0, chartWidth]).domain([0,1]); var xAxis = myMobileLineChart.xAxis(); xAxis.scale(myScale); myMobileLineChart.xAxis(xAxis); }
Alternatively you could alter the source code of the lineareamobile.js file itself (in the ‘measure’ function) to hard code different types of scales and axis values.
I hope this helps point you in the right direction.
Cheers,
Tom
You must be logged in to reply to this topic.
© 2024 — vizuly.io