|
Queries |
Response | ||
|
I need to add at a specific x value a vertical line with a text "end of actual price" |
The vertical line can be achieved by using stripline feature. In stripline you need to specify start and end values. Kindly find the code snippet below.
In the above code we have specified start and end values in data time format, since we have rendered the chart primary x axis in data time format. You can change this with respect to your requirement.
You can add the text using the annotation feature. The annotation can be placed anywhere in the chart area. If you need to move the text while panning chart, then you need to render the annotation based on the points by specifying points to coordinateUnit property. Find the code snippet to achieve this requirement.
Here to the div (with id as actualPrize) element, you can specify the style to customize the font properties with respect to your requirement.
| ||
|
I need to add at a specific x value a dashed vertical line |
This requirement can be achieved by adding a line series with two points having one y values of minimum and maximum ranges of primary y axis and specify the dashArray property with respect to your requirement.
Screenshot:
Sample for reference can be find from below link.
| ||
|
I need to add at the bottom of the chart a text, |
This requirement can be achieved by adding multiple axes to x axis. In that you can customize the font properties as highlighted below.
Screenshot:
Sample for reference can be find from below link.
|
Thanks!
All fine except the last point.
I don't need to customize the axis labels font, but I have to place a text in the bottom right of the chart, indicating the data source.
I needed it there, inside the chart, because it must be there also when I export the chart as an image.
thanks
you can see in the screenshot031 previously attached.
It's simply a text, the data copyright or the data provider name, like "Data source: U.S. Census 2017"
I need to place it in the bottom right corner of the chart, but outside the plot area, just below the x-axis labels.
I need also that is present in the exported image of the chart
I hope the annotations will be exported also when the chart is exported as an image in the next release.
In the meantime, I'd like to show another problem I'm facing with the annotations:
On the playground made by you ( http://jsplayground.syncfusion.com/k2ybg0sd ) you can notice that if you resize the window the annotation lose its vertical initial position.
It would be also very helpful to specify an absolute attachment position for the annotation, like "bottom-right" and a margin. In this case, we are able to place correctly the annotation and it will keep the position during chart resize.
Best,
Marco
|
JS:
<div id= "text" style="font-size:12px; display:none;width:130px; height: 20px;text-align: center">Data source: U.S. Census 2017</div>
$("#container").ejChart({
//...
annotations:[{ visible : true, content : "text", region : "chart", coordinateUnit : "pixels" }],
preRender: "chartPreRender",
afterResize:"resize",
});
function resize(sender){
var annotationEle = document.getElementById("text"),
chart = $("#container").ejChart("instance");
chart.model.annotations[0].x = sender.data.width - parseInt(annotationEle.style.width) + padding;
chart.model.annotations[0].y = sender.data.height -parseInt(annotationEle.style.height);
chart.model.size.height = sender.data.height;
chart.model.size.width = sender.data.width;
chart.redraw();
}
function chartPreRender(sender) {
//Annotation element
var annotationEle = document.getElementById("text");
sender.model.size.width = $("#container").width();
sender.model.annotations[0].x = parseInt(sender.model.size.width) - parseInt(annotationEle.style.width) + padding;
sender.model.annotations[0].y = parseInt(sender.model.size.height) -parseInt(annotationEle.style.height);
} |