I have a problem with bullets. I would like to add bullets above or below of the range, which I will set my own. Unfortunally I didn't find a solution and I came up with an idea to add next series, which will be hidden and I can add to it bullets that I need. I'm wondering if I can filter data on bullets for the first series without adding the second series. Generally, I would like to know if I can filter bullets.
In amcharts 4 exists axis bullets as you can see in this code:
https://codepen.io/team/amcharts/pen/RXREJV
But from what I understood you want something like this:
As you can find in here:
https://doc.cuba-platform.com/charts-6.7/charts.html
Related
I have to show 2 datasets in a LineChart. I have done that to show dots and datasets on LineChart. But, the issue is it is showing dots for null values also which I do not want. Also, I want to show the color of dots which I have given in dataset. I used getDotProps function to get the index of the dataset and to avoid null values. But, it is not working properly when I'm having common values in both the datasets. Please help with failproof procedure along with code to achieve this.
Here is the snack link for the same which is not working properly.
I am working with Dygraph in python. I want to remove a label from the legend. If you look into the example photo attached bellow you can see "A:2.77 B:2.29". Is it possible to remove the B label, but still use its values and to be displayed in the graph?
Currenlty, in my project self.page().runJavaScript(f'g.updateOptions({{file:{file},labels:{labels}}});') is getting the calculated labels and their values and displaying them. However, if I go and remove part of it , it will be removed from the graph as well.
self.exampleCalculated.emit({'Price (Next 2 days)': example_forecast['price1'][0:48], 'SystemPrice': systemPrice[0:48], 'Other': otherPrice[0:48]})
Example
I'm building a depth chart for a trading system. :
We're using Highcharts. There are two approaches: stack two charts next to one another and have separate data, or load the bid and ask data into one list and create the chart that way.
Is one way of preparing the data better?
Will I be able to color half green and the other half red if I combine the data?
I assume the data would be an array of x,y points...
If so, you could find the array index directly in the middle like this...
//This rounding should be verified,
//this is off the top of my head
var midNum = Math.ceil( ( data.length / 2 ) );
Use midNum to change the styling on the points that are the middle point and beyond. Like this...
//should also be checked
.point-selector:nth-child(n+(midNum))
Check out this site for more on nth- selectors, I have always found it helpful.
That selector can be used in plain js or jQuery to select elements for .style or .css() respectively
I want to remove (or make effectively hidden) the first vertical line in the grid for an nvd3 chart. I thought it was a problem with my chart, but after testing it, I realized it seems to be a more general problem.
I tested it by running the line:
d3.selectAll('.tick, .nv-axislabel, .nv-axis text').attr('fill','#999999')
in the console, at the simplest line chart I could find: http://nvd3.org/examples/line.html and it still didn't work! It changes all the lines except the very first vertical line. I'm baffled, I've tried every combination of classes with stroke, fill, opacity, etc - I can either affect the entire svg (with opacity), or nothing. Anyone have any ideas?
EDIT:
I should have specified this originally, I apologize - I do not want to remove the Y axis entirely. I still need the label and the tick marks - I just want to remove that one vertical line (or at least lighten it - it is much darker than the rest of my chart).
Going by your comments:
You don't want to see the " the first vertical line in the grid for an nvd3 chart"
Which is the y axis:
Two ways to achieve that:
Option1
var chart = nv.models.lineChart()
.margin({left: 100}) //Adjust chart margins to give the x-axis some breathing room.
.useInteractiveGuideline(true) //We want nice looking tooltips and a guideline!
.transitionDuration(350) //how fast do you want the lines to transition?
.showLegend(true) //Show the legend, allowing users to turn on/off line series.
.showYAxis(false) //hide the y-axis
.showXAxis(true); //Show the x-axis
Option2:
Since in your example you are going for a CSS option
d3.selectAll('.nv-y').attr('display','none')
I will prefer Option1
EDIT post your clarification, you wish to make the y axis line light you can use:
d3.selectAll('.nv-y path').attr('opacity','0.1')
or if you want to hide it completely
d3.selectAll('.nv-y path').attr('display','none')
One solution is to specify an array of tick values that you want to use for each axis. Use axis.tickValues([values]) to explicitly declare which XAxis ticks you want for your graph. So you could pop .tickValues([1, 2, 3, 5, 8, 13, 21]); into either the chart.xAxis or the chart.yAxis, and ticks would only appear from the corresponding values in the array. In your case, you would want to put it in the chart.xAxis variable. However if you want to have a dynamic chart, explicitly declaring the tick values would pose a problem once the data is updated in the graph. If on the other hand you are using static data, this is a pretty easy fix. I've tested this solution in their live code editor and it seems to do the trick.
Refer to https://github.com/mbostock/d3/wiki/SVG-Axes#ticks to see some other directives that could be of use.
What I want to do:
I have a barChart where the x axis represents time. One can select a period of time by selecting it with the mouse and all the charts correctly adjust to the selection.
However, sometimes it's hard to go from exact dates to exact dates, I would like to add a calendar where one could select those dates.
Ideally, selecting dates on the calendar should have the same effect as selecting the time period with the mouse on the barChart.
Tried but don't like:
I tried to create a second time dimension and make the calendar select on that. However, this makes the barChart min and max values adjust to that selection The barChart does not cover the full dimension of the time dimension, but only the selected period on the calendar. This is what I'd like to avoid.
How can I simulate exactly the selection on the chart itself?
Thanks a lot.
EDIT:
I tried to understand the suggestions made on the comments. Let me show you some code.
I have a barChart:
var moveChart = dc.barChart("#move-chart","chart2");
which is the one that one brushes on to perform time filters.
moveChart
.width(700)
...
.dimension(timeDim)
.group(foo)
Now, lets say I do on the console:
timeDim.filterRange([minTime,maxTime]);
dc.renderAll("chart2");
This makes the other charts reflect the selection, but not the moveChart.
I also tried to implement Gordon's comment but I'm not I understand it. In the console I can see that moveChart.filters. does not implement any filter like RangedFilter or TwoDimensionalFilter, so I'm not sure how to perform the filter function on the brush.
Thanks.
A chart will not observe filters on its own dimension, so I think you really want the brush option.
filter = dc.filters.RangedFilter(filter[0], filter[1]);
moveChart.filter(filter);
Ranged filter doc
You only need to set the filter on the chart; the chart will set the filter on the dimension.