amcharts / amstock3

JavaScript Stock Chart V3
Other
53 stars 31 forks source link

AM STOCK chart label overlapping when move scroll left to right #10

Open pankajd1990 opened 5 years ago

pankajd1990 commented 5 years ago

I am working on AM chart which showing data per milliseconds .but when i move scroll left to right,labels overlaps on each other. this is my code `{ type: "stock", theme: "none",
categoryAxis:{
showFirstLabel:true, showLastLabel:true,
gridPosition: "start", gridAlpha: 1,
tickPosition: "start",
tickLength: 20, autoGridCount :true, centerLabels:true, fontSize:15, glueToTheEnd:true, zoomOutOnDataSetChange:true, dateFormats:[{"period":"fff","format":"JJ:NN:SS.QQQ"},{"period":"ss","format":"JJ:NN:SS"},{"period":"mm","format":"JJ:NN"},{"period":"hh","format":"JJ:NN"}],
}, valueAxesSettings :{ gridThickness:1,
axisColor:"#FFFFFF", showLastLabel:true, axisThickness:1, inside:false, axisAlpha:1, unitPosition:"left", tickLength:1,
labelRotation:-90, }, categoryAxesSettings: { minPeriod:"fff", groupToPeriods:["fff"], color:"#FFFFFF", axisColor:"#FFFFFF",
axisAlpha:1,
dateFormats:[{"period":"fff","format":"JJ:NN:SS.QQQ"},{"period":"ss","format":"JJ:NN:SS"},{"period":"mm","format":"JJ:NN"},{"period":"hh","format":"JJ:NN"}],
equalSpacing:true, gridPosition: "start", gridAlpha: 1, tickPosition: "start", tickLength: 5, inside:false, fontSize:15,

} ,
dataSets: [ {
  color: "white",
  fieldMappings: [ {
    fromField: "MRFILLPRICE",
    toField: "MRFILLPRICE"
  }     
],
 dataProvider:[],
  categoryField: "MRJIFFYTMST",      
   stockEvents: []
} ],

panels: [ {

  title: "Price",
  marginTop:100,
  autoMargins:false,
  percentHeight:60,
  showCategoryAxis: true,
  valueAxes: [{
    position: "left",        
    id:"p1",              
    inside:false,     
    color: "#FFFFFF", 
    axisColor:"green", 
    axisAlpha:1,
    title:"Price",
    axisThickness:5,   
    minMarginTop:20,
    marginTop:20,             
    labelOffset:3,
    labelRotation:-90, 
    maximum:0,
    minimum:0,
    fontSize:15,
    "useDataSetColors": false,      
  },     
],
  stockGraphs: [ {
    id: "g1",
    valueField: "MRFILLPRICE",
    showAllValueLabels:true,
    valueAxis:"p1",
    type: "smoothedLine",
    lineThickness: 1,
    bullet: "round",   
    bulletAlpha:0,
    // forceGap:true,
    bulletSize:0,
    balloonColor:"white",
    lineColor: "red",
    showBalloon:true,

    balloonText:"Time:<b>[[tm]]</b><br> Price:-<b>[[MRFILLPRICE]]</b>",

    gapPeriod:5,
    "useDataSetColors": false,       
  } ],
  stockLegend: {
    valueTextRegular: " ",
    markerType: "square"
}
} ],
stockLegend: {

},
chartScrollbarSettings: {
  graph: "g1",     
  offset:10,
  enable:false,
  autoGridCount:true,
  position:"top"
},
chartScrollbar:{
    offset:200,
    updateOnReleaseOnly: true,
    autoGridCount:true
},
chartCursorSettings: {
  valueBalloonsEnabled: true,
  graphBulletSize: 1,
  valueLineBalloonEnabled: true,
  valueLineEnabled: true,
  valueLineAlpha: 0.5,
  enabled:false,
  categoryBalloonDateFormats: [{
    period: "fff",
    format: "NN:SS:QQQ"
}]
},        
panelsSettings: {
  usePrefixes: true,
  marginLeft:60,      
  marginTop:10, 
},   
export: {
    enabled: true,
    position: "bottom-right"
},
listeners: [ {
    event: "dataUpdated",
    method: function(event) {
      console.log("data updated");
    }
  } ]        

} } Screenshot_3 `

martynasma commented 5 years ago

Try increasing categoryAxesSettings.minHorizontalGap.

Set it to 100 for example. Default is 75.

pankajd1990 commented 5 years ago

not working i put above line in category axis setting ` categoryAxesSettings: { minPeriod:"fff", groupToPeriods:["fff"], color:"black", axisColor:"black",
minHorizontalGap:100, axisAlpha:1,
dateFormats:[{"period":"fff","format":"JJ:NN:SS.QQQ"},{"period":"ss","format":"JJ:NN:SS"},{"period":"mm","format":"JJ:NN"},{"period":"hh","format":"JJ:NN"}],
equalSpacing:true, gridPosition: "start", gridAlpha: 1, tickPosition: "start", tickLength: 5, inside:false, fontSize:15,
autoWrap:true, Screenshot_3

}`
martynasma commented 5 years ago

Well then try a bigger number :)