Hi,
I'm trying to rotate the series on multiple Ajax Bar charts, which are dynamically created on page load, I have manged to find a Java script but I cant think of a way of grabbing the dynamic ID of each chart, as each chart is nested inside a listview.
If I manually add the name of the chart it works (as below), I have tried searching for a hidden field populated with the chart name, but I don't seem to be able to find it usingHiddenfield var x = document.getElementById("Test_Hidden").name; I think this is because it is also dynamically created so the name is not "Test_Hidden" but something like "MainContent_ListView1_ctrl0_Test_Hidden" ?
Any help would be really appreciated ?
<ajaxToolkit:BarChart ID="BarChart1" ChartType="Column" ChartTitleColor="#0E426C" Visible = "false"
BaseLineColor="#A156AB" runat="server" ValueAxisLines="2" ChartHeight="500" Height="500" BorderStyle="None" BorderWidth="0" CssClass="span24" ></ajaxToolkit:BarChart><script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script><script type="text/javascript">
window.onload = function () {
var $svg = $("#MainContent_ListView1_ctrl0_web50repchartsoftpublisher_1").find("svg");
var $series = $svg.find("text[id=SeriesAxis]");$series.each(function (index, element) {
var $element = $(element);
var x = $element.attr("x");
var y = +$element.attr("y") + 10;$element.removeAttr("x");$element.removeAttr("y");$element.attr("transform", "translate(" + x + ", " + y + ") rotate(-270)");
});
};</script>