I have a line chart with chartjs, this has 5 lines. I'd like to render the chart so only 1 line is selected and then the user can add them back in if they want to.
Normally on a chartjs chart you can click a label and the corresponding data line with remove. This is basically what I'm trying to do but on load.
I can't find anything in the documentation to support such a thing.
How can I achieve this?
Just add the following to the data object you want to hide on load:
hidden: true,
Related
We want to display our TrackBall label at the top of the Graph. We do not want to GroupAllPoints but that appears to be the only way to get the label to appear at the top of the graph.
When we do set LabelDisplayMode="GroupAllPoints" the label ignores the LabelTemplate we have set on the LineSeries. I assume that is because GroupAllPoints covers multiple Series.
How do set LabelDisplayMode to NearestPoint but display that label
at the top of the graph?
Alternatively how do I create a Template that does get picked up
when GroupAllPoints is set. Despite us only having a single point
to display in the TackBall. We'd only be doing this if there was no other way to get the trackball to display at the top of the graph.
Based on your requirement we have prepared a sample for your reference. In which we have achieved your requirement using the "annotation" property in the chart. Please find the below sample, code snippet, and screenshot.
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/AnnotationSample-1842581013.zip
Code Snippet:
<ejs-chart id="lineContainer" >
// add additional code here
<e-chart-annotations>
<e-chart-annotation Content="<div id=lineContainer_tooltip></div>" X="90%" Y="1%" CoordinateUnits='#Syncfusion.EJ2.Charts.Units.Pixel' region="Series"></e-chart-annotation>
</e-chart-annotations>
Screenshot:
How can I display one dataseries as bar and another as a line in one graph like it is used in the last comment of: see last picture
Short answer:
It's not possible (yet) using the Grafana UI, only by hand.
Long answer:
As far as I know there is no way of doing this using the UI switches; you'll have to use the use the "alias or regex" fields below the visualisation configuration.
Prepare your data
Before you start, make sure that your queries A and B retrieve actual data. You won't see your data otherwise and be confused why they're not showing.
Adding fields and values to the aliases
Once you are selecting the correct data you want to display, just add the following on the visualisation section of the graph at the 'alias or regex' fields:
Add 2 overrides, one for each value you want to display using the 'Add series override' button.
Add a "Bars:false" option flag and a "Lines:true" for the value you want as a line.
Be sure to use the exact opposite values for your bars ("Bars:true" & "Lines:false")
Add a 'Y-axis: 2' to the value you want to have on the right side of your graph.
Optionally, you can add a "Z-index: 3" for the value that you want to have on top (I added this option to the line to make sure it's always drawing on top of the bars).
Enjoy
You should now have a nice graph with 2 types of data and visualisations in one; something like this:
For those who were asking in the comment section, yes this isn't available in version 8, however, you can still change the time series visualization to graph(old) so you can set the alias/regex.
I am using a combined chart (Stacked Column + Line) for my application. Is it possible to change the line plotting?. (somewhat like shown in RED in the image). If yes then how is it possible?
I'm sure you already know the VIZ documentation where you can find all possible properties of VizFrame. As far as I know there currently is no way to get the behavior you're asking for except for writing your own lineRenderer (vizProperties.plotArea.lineRenderer). There is one alternative line plotting mode available which is smoothening it but I'm sure thats not what you want.
However you could use a second series of column chart instead. Just use a standard column chart and add two data series instead of one. I think this would show the exact information you're trying to get with the current diagram just no connection between them.
Plain and simple, is it possible to do a bar chart like this one.. using google chart ?
I have no code to show you because is very simple to do bar chart but not sure if is possible to generate a difference arrow. (this graph is from Think Cell)
The closest thing I am aware of is Diff Charts. They aren't nearly as explicit in marking the change, but they are a way to visually display the change in a data set.
Using DiffCharts requires to separate google.visualization.DataTable instances with the old data an new data. You then call the computeDiff(oldData, newData) method on the chart instance and it will give you a new DataTable instance that you can use to draw the diff chart.
I'm new to FusionCharts.
I have generated a pie chart with slice, my question is:
When I click on the slice in the pie chart, I need the label name of the slice.
How can I write the on click event and get the name of label?
I don't much about charts and such, I'm fine using Word for this. But in 2D Graphics I've learned you can use
...contains(shape)
...intersects(shape)
To see if shapes are inside eachother (to contain) or if they overlap eachother (to intersect).
When adding a mouseListener, you can use
e.getX() and e.getY()
to get the current X and Y position of mouse on screen.
So something like
for (pieChartPieces p: piece)
{
if (pieChartShape.contains(e.getX, e.getY))
{
//* Some kind of notifier for user pops up here.
}
}
Check out this fiddle here
It uses "dataplotClick" event to retrieve the label of the pie slice.
You have to use link attribute, as seen here.
"link": "JavaScript:populate('411');",
See the jsFiddle.
Don't forget to implement the populate() with the whatever you need to do.
Link to a similar question (with answer).