Uncaught Error: Invalid dimensions for plot, width = 335, height = 0 - flot

Everytime i refresh my page, i get this error in the console
Uncaught Error: Invalid dimensions for plot, width = 335, height = 0
The pie chart loads the first time, but on refresh, it throws this error and does not appear.
Any suggestions /solutions ?
Thanks

You probably forgot to specify the height for the div holder of the graph.
<div id="myGraph" style="height:500px;"></div>
This will probably solve your issue. :)

Related

Character spacing for chart axes in Excel VBA

I am trying to use a macro to change the character spacing for my legend and axes labels on charts from the default 0 to 0.2. I used the record macro function and the result for the legend works fine. Specifically:
ActiveChart.Legend.Select
With Selection.Format.TextFrame2.TextRange.Font
.BaselineOffset = 0
.Spacing = 0.2
End With
But the result for the axes throws up an error when I try to run it myself. e.g:
ActiveChart.Axes(xlCategory).Select
With Selection.Format.TextFrame2.TextRange.Font
.BaselineOffset = 0
.Spacing = 0.2
End With
Once I run the second line, it tells me: "Run-time error xxxxx. Method TextFrame2 of object ChartFormat failed"
Any ideas on how I can change the character spacing for axes labels correctly?
Many thanks!
For some reason the error occurs when trying to access the TextFrame2 property of the axis.
Depending on your exact need a work around might be to set the spacing for the whole chart area at once.
Something along the lines of:
with ActiveChart.ChartArea.Format.TextFrame2.TextRange.Font
.Spacing=0.2
end with

DOMException error was thrown on calling cavas.toDataUrl()

When we call "canvas.toDataURL('image/png')" after some changes (such as drag and move an image in the canvas by fabricjs), an exception was thrown:
The image argument is a canvas element with a width or height of 0
What is this mean? Obviously our canvas element has its own width and height, and none of them is 0.

MQL4 drawing rectangle over price

I am trying to write a label in a rectangle over the price in the top left corner of my chart with my custom indicator. I can draw the rectangle and the label fine but I cannot get the order in which they display correct. The candlestick chart is always at the top and I can switch around the label and the rectangle's orders by using the following code
ObjectSetInteger(NULL, "objBackground", OBJPROP_BACK,true);
Please help, how do I put the candlesticks at the back, then the rectangle and the label(s) at the the forefront?
Thanks for your help!
Just make chart not on the foreground and you will see objects on top
bool ChartForegroundSet(const bool value,const long chart_ID=0)
{
//--- reset the error value
ResetLastError();
//--- set property value
if(!ChartSetInteger(chart_ID,CHART_FOREGROUND,0,value))
{
//--- display the error message in Experts journal
Print(__FUNCTION__+", Error Code = ",GetLastError());
return(false);
}
//--- successful execution
return(true);
}

Nightmarejs screenshot doesn't clip at the bottom of long pages

I am trying to make a screenshot at the bottom of the long page (e.g. http://www.taoism.net/ttc/complete.htm) like so:
Nightmare({ show: false })
.viewport(1024, 30000)
.goto('http://www.taoism.net/ttc/complete.htm')
.wait()
.screenshot(sImagePath, {
x : 0,
y : 27711,
width : 1024,
height : 133
});
Screenshot file size is 0 bytes.
Tested with different y values, it works until ~8000px.
Tried using .scrollTo, it did not help.
Does anybody know a workaround?
P.S. Nightmarejs wraps around electron browser.
This might be what you've looking for https://github.com/segmentio/nightmare/issues/328#issuecomment-159311982
Basically you dynamically adjust the viewport dimensions based on the content to grab size.

How to render end ticks always using d3 svg axis

I am not sure how the tick placement works with d3 svg axis. I tried playing with the ticks, tickSize options but essentially I get the start and end ticks "sometimes" with random data plotted
http://plnkr.co/edit/i5DBgfWzr2sa8Yugg2A8?p=preview
(Please ignore the angularjs aspect. The part that I am interested in is the following in d3)
var make_x_axis = function () {
return d3.svg.axis()
.scale(x)
.orient("bottom")
.ticks(5)
.tickFormat("")
.tickPadding(8);
};
var make_y_axis = function () {
return d3.svg.axis()
.scale(y)
.ticks(6)
.orient("left")
.tickSize(10,10)
.tickPadding(8);
};
How do I always get the start and end ticks rendered for both X and Y axis? I clearly always get the start and end tick lines on both X and y axis (Unsure how that is happening - I do not see a .tick element at that location in the chrome inspector) but the labels are missing. I can find the first and last tick and render a text with the tick label info but clearly I cannot always do it because sometime the axis gives me the start ticks and sometime it does not.
Any help is appreciated.
Thank you
I am not sure I fully understand your question, if you want to remove the ending x-axis ticks, you should set
d3js V3
.outerTickSize(0),
d3js V4 - V6
tickSizeOuter(0)
If you want to customize the ending ticks, you may use
.tickValues(y.ticks(5).concat( y.domain() ));
Have a look at my JSFiddle for a demonstration.

Resources