Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion experiment/src/org/labkey/experiment/DotGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ private String escape(String s)
{
return null;
}
return s.replace("\"", "\\\"").replace("\n", " ").replace("\r", " ");
return s.replace("\\", "\\\\").replace("\"", "\\\"").replace("\n", " ").replace("\r", " ");
}

private class MNode extends DotNode
Expand Down
15 changes: 8 additions & 7 deletions experiment/src/org/labkey/experiment/ExperimentRunGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.graphper.api.Graphviz;
import org.graphper.draw.ExecuteException;
import org.graphper.parser.DotParser;
import org.graphper.parser.ParseException;
import org.labkey.api.data.Container;
import org.labkey.api.exp.ExperimentException;
import org.labkey.api.exp.api.ExpData;
Expand Down Expand Up @@ -48,22 +49,22 @@ public static void renderSvg(Writer out, Container c, ExpRunImpl run, boolean de

private static String getSvg(String dot) throws ExecuteException
{
Graphviz graph = DotParser.parse(dot);

if (graph.isEmpty())
return ""; // Graphviz.toSvgStr() throws an exception if the graph is empty.

try
{
Graphviz graph = DotParser.parse(dot);

if (graph.isEmpty())
return ""; // Graphviz.toSvgStr() throws an exception if the graph is empty.

String svg = graph.toSvgStr();

// Scale down to 50% of default size. This is arbitrary but seems reasonable. Diagrams are larger than
// the old image-based ones, but monitors are much higher resolution than when those were scaled.
return SvgUtil.scaleSize(svg, 0.5f);
}
catch (ExecuteException ex)
catch (ExecuteException | ParseException ex)
{
LOG.warn("Error generating graph", ex);
LOG.error("Error generating graph", ex);
throw ex;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* limitations under the License.
*/
%>
<%@ page import="org.graphper.draw.ExecuteException" %>
<%@ page import="org.labkey.api.util.UniqueID" %>
<%@ page import="org.labkey.api.view.HttpView" %>
<%@ page import="org.labkey.api.view.template.ClientDependencies" %>
Expand Down Expand Up @@ -67,7 +66,7 @@
model.getFocusType()
);
}
catch (ExecuteException e)
catch (Exception e)
{
out.write("<p class=\"labkey-error\">Error rendering graph</p>");
}
Expand Down
Loading