I have a data chart DataChart would like to shift data of xAxis along with data lines to right by certain value.
DataChart Screen Shot
Please help me out which property to use from the library that would be able to solve this purpose.
I am using Daniel Gindi line charts for this purpose.
I use this to create an offset to the left of my chart
myChart.xAxis.spaceMin = 10
maybe it'll do for you
And to align the yAxis lines in front of the labels, i think you could remove the background grid and create your own limit lines if you don't find any other way around
is it viable to subtract the distance d from the x values? that would shift it rightward.
d = 7.0
rightShifted = newGraphData.values.map{ChartDataEntry(x:$0.x-d, y:$0.y)}
Related
According example image I want to create my chart like that. My data entries have both positive and negative values, I want to set 0 in the middle of y-axis everytime.
Is impossible to do that?
Ps. I use Charts library with swift version 5.
Calculate the biggest number on the Y-axis in the chart's dataSet.
let maxValue = max(dataSet)
chart.setChartMinMaxYValues(chartYMin: -(maxValue), chartYMax: maxValue)
Consider the following high chart
At 15 jun, category II has no data, what if I dont want that spacing left for it, Is there anyway to remove such spaces.
for code reference
`http://jsfiddle.net/G5S9L/8/`
I don't see anything in the API that allows you to do this. As a kludgy workaround you could shift the columns yourself in the onload callback:
, function(chart){
var barLeft = $(chart.series[0].data[1].graphic.element);
var barRight = $(chart.series[2].data[1].graphic.element);
barLeft.attr('x',parseInt(barLeft.attr('x')) + parseInt(barLeft.attr('width'))/2);
barRight.attr('x',parseInt(barRight.attr('x')) - parseInt(barRight.attr('width'))/2);
});
Updated fiddle.
This is how Highcharts work. It calculates the space for categories, then divide it between series. It doesn't matter if you have data or not, space is given for possible points.
I am using highcharts library to draw chart and I need to display Weekdays as labels on x-axis and also to auto reset it like from Monday to M if all weekdays can't fit on screen.
It should be dynamic, which means no flickering should appear when changing label text on x-axis.
Any suggestions?
Thanks in advance.
There is no straight option for that, rather simple workaround:
Disable reflow from Highcharts, use window.resize browser event
In that event add condition to decide showing full name of just shortened, and set this for chart - chart.xAxis[0].dateTimeLabelFormats should be fine
After setting new format, apply new chart dimensions using chart.setSize(w, h)
In a Highcharts column chart we'd like to highlight one value/sample by drawing its column a little bit wider... But this seems not to be possible, is it?
pointWidth only affects the whole series.
Maybe I could overlay a second series, but IMHO that's not a nice solution.
You can also use data attribute and modify width.
http://jsfiddle.net/cDvmy/2/
chart.series[0].data[0].graphic.attr({
width:50
});
I don't see any way to do this with the current API. As an equally not nice solution you could adjust the SVG after the plot is drawn:
// make fifth bar of first series wider
var bar = $($('.highcharts-series').children()[4]);
bar.attr('width',parseInt(bar.attr('width'))+20);
bar.attr('x',parseInt(bar.attr('x'))-10); // keep it centered
Fiddle here.
I'm using CorePlot for my current project and its amazing.
The only problem I came across is the length of the axis and grids.
I'm only using a positiv coordinate system with labels on the left and bottom side.
And my problem is the length of the axis and grids in direction to my labels.
I tried to use:
axisSet.xAxis.orthogonalCoordinateDecimal = CPTDecimalFromString(#"-value");
axisSet.yAxis.orthogonalCoordinateDecimal = CPTDecimalFromString(#"-value");
or
x.labelOffset = value;
y.labelOffset = value;
but this is only setting the distance of my labels different and not affecting the grids length.
In my example the y-axis and there grid overlaps my label:#{1,2,3,4,5,6,7,8}
Did somebody dealed with the same problem? THX for all answer to the right way!
Use the visibleRange and gridLinesRange to limit the axes and grid lines, respectively. See the "Control Chart" in the Plot Gallery example app for sample code.