Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Can I place an image over a chart at a specific position?
Collapse
X
-
Can I place an image over a chart at a specific position?
Is there a way to place an image (say a jpeg) over a chart at a specific bar and price?Tags: None
-
Hello AnotherTrader , thanks for your question.
This is possible with the use of SharpDX in the OnRender method. You can place any bitmap image onto a chart.
We have an example that I have attached to this post. This example draws a SharpDX Bitmap onto the RenderTarget. First, the images are loaded into Bitmap objects in the UpdateImage method, then the image is drawn to the RenderTarget with the SharpDX “DrawBitmap” method. Note that RenderTarget dependent resources must be disposed and recreated when the RenderTarget changes, or with each OnRender pass. Use OnRenderTargetChange as demonstrated for better performance.
The Bitmap should be updated in OnRender, and any signals to change the Bitmap should be signaled in OnBarUpdate, and then changed in the next OnRender pass.
Please let me know if you have any questions on this material.Attached FilesChris L.NinjaTrader Customer Service
-
How could I set it up so that additional text appears if the user runs their mouse over the image?
Comment
-
you can try this code to place an image over a chart at a specific position
Step 1
HTML Code:var chart = new CanvasJS.Chart("chartContainer",{ title :{ text: "Position Image over chart" }, data: [{ type: "column", dataPoints : [ { label: "apple", y: 10 }, { label: "orange", y: 15 }, { label: "banana", y: 25 }, { label: "mango", y: 30 }, { label: "grape", y: 28 } ] }] }); chart.render();
HTML Code:$('img').attr('src', url) .attr("class", label) .css({"display": "none"}) .appendTo($('#chartContainer>.canvasjs-chart-container'));
Step3:
HTML Code:imageBottom = chart.axisX[0].bounds.y1; imageCenter = chart.axisX[0].convertValueToPixel(chart.data[0].dataPoints[0].x); image.css({"position": "absolute", "display": "block", "top": imageBottom - fruit.height(), "left": imageCenter - fruit.width()/2 });
- Likes 1
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by hazylizard, Today, 08:38 AM
|
0 responses
0 views
0 likes
|
Last Post
by hazylizard
Today, 08:38 AM
|
||
Started by Max238, Today, 01:28 AM
|
5 responses
42 views
0 likes
|
Last Post
by Max238
Today, 08:30 AM
|
||
Started by giulyko00, Yesterday, 12:03 PM
|
3 responses
12 views
0 likes
|
Last Post Today, 08:26 AM | ||
Started by habeebft, Today, 07:27 AM
|
1 response
14 views
0 likes
|
Last Post Today, 08:08 AM | ||
Hi
by AveryFlynn
Started by AveryFlynn, Today, 04:57 AM
|
1 response
12 views
0 likes
|
Last Post Today, 07:57 AM |
Comment